Wrong model name imported in the example
|Reported by:||er.balram.singh1990@…||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Hi, I am new to Django and I was learning through documentation. In the part three, in the "Write views that actually do something" section, the model name 'Question' is imported instead of 'Poll', as that is created in previous part 2. This is throwing an exception saying 'Can't import Question Model'.
from django.http import HttpResponse from polls.models import '''Question''' def index(request): latest_question_list = '''Question'''.objects.order_by('-pub_date')[:5] output = ', '.join([p.question_text for p in latest_question_list]) return HttpResponse(output)
I have tried to replace that with 'Poll' and that worked. So please update the doc if you find the same.
Secondly, in the view's index template, replace the text 'question.question_text' with 'question' and that will work fine.