> question = models.CharField(max_length=200)
> pub_date = models.DateTimeField('date published')
> def __unicode__(self):
> return self.question
>
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice = models.CharField(max_length=200)
> votes = models.IntegerField()
> def __unicode__(self):
> return self.choice
>
> When I execute the command Poll(objetcs.all): I get as result the
> following: class [<Poll: Poll object>, <Poll: Poll object>] when I;m
> supposed to get as result [<Poll: What's up?>]
>
> I don't know what is missing. If someone can help me I would
> appreciate it. Thanks!!
Apart from the problem Kenneth pointed out, you seem to have the
indentation wrong. The "def __unicode__" belongs to the class, not on
the same level as the "class" word.
Cheers
Jirka
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment