Hi,

I've just started using Django and have been following the 'Writing
your first Django App' tutorial. So far so good, but I've run into a
little irritation - the use of the _unicode_ method doesn't work for
me. I'm using Django 1.2.1. I'm pretty sure I've got the indenting
right, but when I run the Python shell the only response I get for
Poll.objects.all() is Polls: poll objects and not the objects
themselves. This is my code as I've been following along on Page 1 of
the tutorial.

Thanks


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

class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice = models.CharField(max_length=200)
    votes = models.IntegerField()
    def _unicode_(self):
        return self.choice

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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