Hi everybody

I have to excuse myself for the newbie question which is following
now:

Now I am doing the Poll/Models Tutorial on this page

http://docs.djangoproject.com/en/dev/intro/tutorial01/

and I am stuck at this point:

Wait a minute. <Poll:  Poll object> is, utterly, an unhelpful
representation of this object. Let's fix that by editing the polls
model (in the polls/models.py  file) and adding a __unicode__()
method to both Poll  and Choice:

I changed the code in the models.py to this:

import datetime
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_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.question


I know the structure is wrong.
Any suggestions would be greatly appreciated.

Thanks!!

Best

Z

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