I am doing the Django tutorial, where I created a model, did syncdb, and started the python shell. However, when I run the code poll.objects.all(), it shows an error:
>>> poll.objects.all()
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'poll' is not defined
No matter what I try the same error keeps coming:
NameError: name ‘poll’ is not defined
I am trying to figure out how to resolve this so I can use the various db lookup functions. I have already imported the classes:
from polls.models import Poll, Choice
How do you fix this?
You have a typo. Try
Pollinstead ofpoll