Boston Python Workshop/Saturday/Web app project: Difference between revisions

Line 290:
def __unicode__(self):
return self.choice
 
Save the models.py file.
 
It's important to add __unicode__() methods to your models, not only for your own sanity when dealing with the interactive prompt, but also because objects' representations are used throughout Django's automatically-generated admin.
Line 308 ⟶ 306:
Note the addition of import datetime to reference Python's standard datetime module.
 
Save these changes to the models.py file, and then start a new Python interactive shell by running python manage.py shell again:
 
>>> from polls.models import Poll, Choice
Anonymous user