40๐
โ
I think the code you posted above, is not the one you have on your disk.
I had the same problem, but then I looked carefully at both, my code and the tutorial. The regex I had in my code was different from the tutorial.
This was my code:
url(r'^(?P<poll_id>\d+)/$',-$
url(r'^(?P<poll_id>\d+)/results/$',-$
This is the correct core:
url(r'^(?P<pk>\d+)/$',-$
url(r'^(?P<pk>\d+)/results/$',-$
Note that *poll_id* was in the previous sections of the tutorial, but generic views require pk. Also note that the tutorial is correct, and you posted the correct code (from the tutorial.)
๐คnbensa
0๐
Look Carefully in the Tutorials they have mentioned to change the urlpatterns to use primarykey instead of question_id.
๐คNaman
- How to return data with 403 error in Django Rest Framework?
- A good way to encrypt database fields?
- Django multi-table inheritance alternatives for basic data model pattern
Source:stackexchange.com