Best Regards,
Eiram
On Thu, Jun 30, 2011 at 10:06 AM, Jirka Vejrazka <jirka.vejrazka@gmail.com> wrote:
> class Poll(models.Model):Apart from the problem Kenneth pointed out, you seem to have the
> 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!!
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.
--
Jarilyn M. Hernández
MS Computer Science
Polytechnic University of Puerto Rico
Tel: (787) 408-6637
--
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