Hey Jeff, Yes, these methods would go inside of your Poll Class. I'm not sure if the indentation was messed up through e-mail, but make sure that your method body is indented one step deeper than your method signature. For example:
class Poll(...): #.... def __unicode__(self): return self.question You can put these methods anywhere within your Class. I don't believe it will matter on the order at all (when dealing with methods inside of a single class). Good luck! On Tue, Jul 17, 2012 at 1:43 PM, jeffsarge <j...@sargetv.com> wrote: > Hi, > I'm learning Django and Python at the same time. Going through the Django > tutorial (writing your first Django app) > Going smooth until I hit the part where I need to add a unicode method to > both Poll and Choice: > > def __unicode__(self): > return self.question > > same with the custom methods that are supposed to be added (def > was_published_recently(self): > > Do these just get stuck onto the end of my class Poll(models.Model):? > like this... > > class Poll(models.Model): > question = models.CharField(max_length=200) > pub_date = models.DateTimeField('date published') > > def __unicode__(self): > > return self.question > > def was_published_recently(self): > return self.pub_date >= timezone.now() - datetime.timedelta(days=1) > > I'm not sure what the correct way is to add this code to the python > classes I created earlier in the polls/models.py > Any ideas? > > thanks, > Jeff > > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/2h8gM7CDls8J. > 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. > -- 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.