Starting polls again

Going through the tutorials and learning Django will inevitably lead you to a path where errors occur due to your lack of experience. Keep in mind, there is absolutely NOTHING wrong with that; it’s simply part of the learning curve :slight_smile:

Even those with more experience run into weird syntax errors like that at times. I know syntax can be frustrating to learn at times, but now that you’ve encountered that issue you will know how to resolve it in the future!

I am just curious. Is this error, where there is no correct instruction in the tutorial, due to my lack of experience? Why wouldn’t the author of the tutorial want to make everything correct and clear?

I now see the double underscore in your statement. So I went back to the tutorial and could see that, indeed, the code showed a double unscore, but it was very hard to see and I certainly am unfamiliar with that protocol. The author of this tutorial has highlighted many traps which has been helpful but not this one. Painful…

Well, after rereading Ken’s comment, I see the correct code in the tutorial but, you are right, lack of experience and the subtle difference between a single underscore and the run together double is challenging. Being inexperienced is costly.

I agree - the reference to the double-underscore doesn’t appear as a comment in that example until later, and the doc reference appears after that code block.
It may be worth moving that comment earlier in that code block, or adding a comment before that line highlighting the need for a double-underscore at that location.

Hi Ken,
Thanks. Would you mind pointing out to me where the reference to the underscore appears? I must have missed it in part two which is highly likely. I do seriously try to read everything carefully.

Cheers. Ralph

PS. I had a really cool Lotus Cortina a long time ago. It featured a Ford engine.

First, to try and be clear - I agree with you. It could be more obvious how it’s being used at that point. No problem with suggesting something more explicit being written for that.

In the context of a tutorial, there’s only so much you can explain at any one time. By necessity, there are some topics that must be glossed over early on to stay narrowly focused on the particular topic at hand, and a lot of things need to be just accepted.

From part two, in the example where it’s being used (but lower down):

# The API automatically follows relationships as far as you need.
# Use double underscores to separate relationships.
# This works as many levels deep as you want; there's no limit.
# Find all Choices for any question whose pub_date is in this year
# (reusing the 'current_year' variable we created above).

Then, back in the regular text below this code block:

For more information on model relations, see Accessing related objects. For more on how to use double underscores to perform field lookups via the API, see Field lookups. For full details on the database API, see our Database API reference.

I struggle so much with this stuff. I have completed this tutorial twice and started four times. I keep reading that it’s normal to be discouraged, to think you are an idiot (even though I have very high IQ), and to make so many mistakes. I have taken all kinds of tutorials mostly on Python. You and your associates do the best job I have seen so far. In fact, it seems like while all these companies are built to make money off of wanna be programmers, they don’t think about how hard it is for new programmers when they make mistakes and are unclear in their instructions. New programmers, blame themselves for a long time typically before they ask for help. I tried to discuss this with the founder of Real Python but someone had hurt his feelings when he was a teenager and he was just too sensitive. I think a lot about how to make this better. I also think it’s great that you guys, the core of Django, work hard to make this tutorial effective and useful and that you support it. My sincere gratitude on that front. With regard to the number of times I have tried to complete this tutorial, when I finished Part 2 a couple of days ago thanks to the help with the double underscore, I realized that I had a much deeper understand of what was going on. Reading the words is useful, practice is more useful and finally getting something right is what it takes. When you have to struggle this hard you wonder if you are cut out for it or if it is even worthwhile. Getting a little help makes a huge difference. Thank you.