Need to Fix the Documentation

Hi, I was following Tutorial 4 on the documentation page and I stumbled upon an error which is as follows “AttributeError: ‘Choice’ object has no attribute ‘votes’” After some searching, I saw that there is some typo mistake in the “Vote View” and “Result.html” page. Need to change the “votes” to “vote” on both pages. Otherwise, it will give the above-mentioned error.

1 Like

One of the causes of this error would be making a mistake on your model definition back on page 2.

From the tutorial:

class Choice(models.Model):
    question = models.ForeignKey(Question, on_delete=models.CASCADE)
    choice_text = models.CharField(max_length=200)
    votes = models.IntegerField(default=0)
    ^^^^^ verify that you have this field defined correctly.

Given the number of people who have worked on and worked through this tutorial, your first assumption in the case of an error should always be that you have missed something, not that there is a problem in the tutorial. (No, it’s not that errors don’t happen, but when they do they’re usually identified very quickly.)