The method should begin and end with two underscores: __unicode__(self):

On Wed, Apr 11, 2012 at 11:30 AM, Brandy <brandy.norri...@yahoo.com> wrote:

> I am working through the tutorial and have already added the def
> _unicode_ statements to my code. However, when running
> Poll.objects.all(), I still get this output: [<Poll: Poll object>]
>
> Here is the code:
>
> from django.db import models
>
> 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)
>
> class Choice(models.Model):
>        poll = models.ForeignKey(Poll)
>        choice = models.CharField(max_length=200)
>        votes = models.IntegerField()
>        def _unicode_(self):
>                return self.choice
>
> Thank you for any help!
>
> --
> 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.
>
>


-- 
Jonathan D. Baker
Web Developer
http://jonathandbaker.com
303.257.4144

-- 
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