On Mon, Feb 9, 2009 at 8:07 AM, jfmxl <jf...@yahoo.com> wrote: > > # Create your models here. > > class Poll(models.Model): > question = models.CharField(max_length=200) > pub_date = models.DateTimeField('date published') > > class Choice(models.Model): > poll = models.ForeignKey(Poll) > choice = models.CharField(max_length=200) > votes = models.IntegerField() > > class Poll(models.Model): > # ... > def __unicode__(self): > return self.question > > class Choice(models.Model): > # ... > def __unicode__(self): > return self.choice > > class Poll(models.Model): > # ... > def was_published_today(self): > return self.pub_date.date() == datetime.date.today() >
You're only supposed to have one class Poll(...), class Choice(...), etc. line. When you add a method like __unicode__ or was_published_today, simply append it (properly indented) to the existing class Poll(...) you already have. Do not add another class Poll(...) line. Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---