IndexView is missing a QuerySet. Define IndexView.model, IndexView.queryset, or override IndexView.get_queryset().
| Request Method: | GET |
|---|---|
| Request URL: | http://localhost:8000/polls/ |
| Django Version: | 2.2.4 |
| Exception Type: | ImproperlyConfigured |
| Exception Value: | IndexView is missing a QuerySet. Define IndexView.model, IndexView.queryset, or override IndexView.get_queryset(). |
| Exception Location: | E:\computer stuff\python\lib\site-packages\django\views\generic\list.py in get_queryset, line 39 |
| Python Executable: | E:\computer stuff\python\python.exe |
| Python Version: | 3.7.3 |
| Python Path: | ['E:\\computer stuff\\python\\Django\\mysite', 'E:\\computer stuff\\python', 'E:\\computer stuff\\python\\Lib', 'E:\\computer stuff\\python\\Django\\mysite', 'E:\\computer stuff\\python\\python37.zip', 'E:\\computer stuff\\python\\DLLs', 'E:\\computer stuff\\python\\lib\\site-packages', 'E:\\computer stuff\\python\\lib\\site-packages\\scrapy-1.5.0-py3.7.egg', 'E:\\computer ' 'stuff\\python\\lib\\site-packages\\service_identity-18.1.0-py3.7.egg', 'E:\\computer stuff\\python\\lib\\site-packages\\pydispatcher-2.0.5-py3.7.egg', 'E:\\computer stuff\\python\\lib\\site-packages\\parsel-1.5.1-py3.7.egg', 'E:\\computer stuff\\python\\lib\\site-packages\\six-1.12.0-py3.7.egg', 'E:\\computer stuff\\python\\lib\\site-packages\\cssselect-1.0.3-py3.7.egg', 'E:\\computer stuff\\python\\lib\\site-packages\\pyopenssl-19.0.0-py3.7.egg', 'E:\\computer ' 'stuff\\python\\lib\\site-packages\\lxml-4.3.4-py3.7-win-amd64.egg', 'E:\\computer stuff\\python\\lib\\site-packages\\queuelib-1.5.0-py3.7.egg', 'E:\\computer stuff\\python\\lib\\site-packages\\w3lib-1.20.0-py3.7.egg', 'E:\\computer ' 'stuff\\python\\lib\\site-packages\\pyasn1_modules-0.2.5-py3.7.egg', 'E:\\computer stuff\\python\\lib\\site-packages\\win32', 'E:\\computer stuff\\python\\lib\\site-packages\\win32\\lib', 'E:\\computer stuff\\python\\lib\\site-packages\\Pythonwin'] |
| Server time: | Fri, 1 Nov 2019 01:03:42 -0700 |
E:\computer stuff\python\lib\site-packages\django\core\handlers\exception.py in innerE:\computer stuff\python\lib\site-packages\django\core\handlers\base.py in _get_responseE:\computer stuff\python\lib\site-packages\django\core\handlers\base.py in _get_responseE:\computer stuff\python\lib\site-packages\django\views\generic\base.py in viewE:\computer stuff\python\lib\site-packages\django\views\generic\base.py in dispatchE:\computer stuff\python\lib\site-packages\django\views\generic\list.py in getE:\computer stuff\python\lib\site-packages\django\views\generic\list.py in get_querysetadmin
No GET data
No POST data
admin
No GET data
| Variable | Value |
|---|---|
| csrfmiddlewaretoken | |
| choice |
class IndexView(generic.ListView): template_name = 'polls/index.html' context_object_name = 'latest_question_list' def get_queryset(self): """Return the last five published questions.""" return Question.objects.order_by('-pub_date')[:5]
the def get_queryset(self): function is missing. check the indendation as well. always produce the code snippet.