dani
dani

Reputation: 341

Error following django tutorial

I'm trying to follow the 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.

Upvotes: 1

Views: 156

Answers (2)

Guilherme David da Costa
Guilherme David da Costa

Reputation: 2368

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.

Upvotes: 0

heavilyinvolved
heavilyinvolved

Reputation: 1575

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.

Upvotes: 3

Related Questions