Hi,

class Poll(models.Model):
    # ...
    def __unicode__(self):
        return self.question

class Choice(models.Model):
    # ...
    def __unicode__(self):
        return self.choice

You probably have used self.question in the Choice class instead of self.choice

Regards,
Xavier Ordoquy,
Linovia.

Le 6 oct. 2012 à 00:33, TJ Marbois <tmarb...@gmail.com> a écrit :

> hi Im following the first Django tutorial...
> 
> I thought I was doing everything correctly till I hit this spot:
> 
> from 
> 
> https://docs.djangoproject.com/en/1.4/intro/tutorial01/
> 
> everything worked as expected till I got to this specific command in the 
> shell...
> # Create three choices.
> >>> p.choice_set.create(choice='Not much', votes=0)
> 
> I instead got this:
> 
> >>> p.choice_set.create(choice='Not much', votes=0)
> Traceback (most recent call last):
>   File "<console>", line 1, in <module>
>   File 
> "/Users/tmacbook/Documents/CODING/django/Sites/vTenv/lib/python2.7/site-packages/django/db/models/base.py",
>  line 373, in __repr__
>     u = unicode(self)
>   File 
> "/Users/tmacbook/Documents/CODING/django/Sites/myFirstDjangoSite/polls/models.py",
>  line 25, in __unicode__
>     return self.question
> AttributeError: 'Choice' object has no attribute 'question'
> 
> Can anyone help?
> 
> cheers
> 
> Tj
> 
> 
> -- 
> 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/-/S0BWK0XjNasJ.
> 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.

Reply via email to