[Answer]-Why does the Django tutorial use choice.choice as a variable in detail.html?

1👍

poll.choice_set.all() returns the entire set of Choices associated with the Poll (via the Choice.poll ForeignKey). The choice attribute is the CharField within the Choice model as described in part 1 of the tutorial. Using {{ choice }} works since Choice.__unicode__() is defined in part 1 as returning the value of the choice field.

Leave a comment