开发者

Error following django tutorial

I'm trying to follow th开发者_Python百科e django tutorial but I get this error and I can't continue. http://dpaste.com/630957/

Can someone help me? (I'm new with python and django) Thank you so much.


From the error log:

File "/arpa/h/huksy007/Projects/mysite/polls/models.py" in __unicode__
    22.         return self.question

Make sure that self actually has a property called question.


You forgot to put that line on your Choice Model:

    choice = models.CharField(max_length=200)

It need to be like that:

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

EDIT:

Sorry, I was thinking of something else and didn't realize it was this line you should change to your model:

def __unicode__(self):
    return self.choice

You probably have this on your Choice model:

def __unicode__(self):
    return self.question

And question its from the Poll model.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜