On Mon, Oct 12, 2009 at 2:19 AM, Denis Bahati <djma...@gmail.com> wrote: > if i change the code like the one shown below it gives me the traceback > about indents, i also included below. > from django.db import models > import datetime > 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_today(self): > return self.pub_date.date() == datetime.date.today() > def was_published_today(self): > return self.pub_date.date() == datetime.date.today() > was_published_today.short_description = 'Published today?' > > class Choice(models.Model): > poll = models.ForeignKey(Poll) > choice = models.CharField(max_length=200) > votes = models.IntegerField() > def __unicode__(self): > return self.choice
No, it is stell wrong. Your model definitions need to look like this: http://dpaste.com/hold/106119/ Note how the methods are indented at the same level of the model field definitions because both of them pertain th the same class (the model). I'd suggest to read some Python material to familiarize yourself with indentation rules and class definitions. Regards, -- Ramiro Morales | http://rmorales.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---