#27618 closed Uncategorized (invalid)
docs/intro/tutorial04.txt: Incorrect Information in Amend Views section
Reported by: | Karan Sharma | Owned by: | Karan Sharma |
---|---|---|---|
Component: | Documentation | Version: | 1.10 |
Severity: | Normal | Keywords: | tutorial, documentation |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
In the tutorial https://docs.djangoproject.com/en/1.10/intro/tutorial04/#amend-views, the tutorial says that no changes needed
for vote()
def vote(request, question_id): ... # same as above, no changes needed.
Since question_id
is replaced by pk
, so this change needs to be done in the vote()
method as well.
Error Log:
Traceback: File "/Users/ninjaPython/Work/django-tutorial/venv/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner 39. response = get_response(request) File "/Users/ninjaPython/Work/django-tutorial/venv/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response 187. response = self.process_exception_by_middleware(e, request) File "/Users/ninjaPython/Work/django-tutorial/venv/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response 185. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/ninjaPython/Work/django-tutorial/myblog/polls/views.py" in vote 26. question = get_object_or_404(Question,pk=question_id) Exception Type: NameError at /polls/1/vote/ Exception Value: name 'question_id' is not defined
Screenshot: http://i.imgur.com/m3d7GDA.png
I'd like to submit a patch for it if the community approves it as a bug.
Change History (4)
comment:1 by , 8 years ago
Owner: | changed from | to
---|
comment:2 by , 8 years ago
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
comment:3 by , 8 years ago
Resolution: | invalid → fixed |
---|
Damn, that was my stupid mistake. Thanks and sorry though!
comment:4 by , 8 years ago
Resolution: | fixed → invalid |
---|
Note:
See TracTickets
for help on using tickets.
I don't see
question_id
replaced bypk
in the URL patterns. I seeurl(r'^(?P<question_id>[0-9]+)/vote/$', views.vote, name='vote'),
. Maybe you made a typo?