Anonymous user
Boston Python Workshop/Saturday/Web app project: Difference between revisions
Boston Python Workshop/Saturday/Web app project (view source)
Revision as of 20:36, 5 March 2011
, 13 years ago→Playing with the API
Line 290:
def __unicode__(self):
return self.choice
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
|