#13623 closed (fixed)
Code in intro-tutorial03 missing a import statement
Reported by: | Owned by: | Horst Gutmann | |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Keywords: | tutorial | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Page: http://docs.djangoproject.com/en/dev/intro/tutorial03/#intro-tutorial03
Last code block. File: mysite/polls/urls.py
Missing code: from django.conf.urls.defaults import *
It is not an error because it says to "Copy the file mysite/urls.py to mysite/polls/urls.py.", but can lead to errors.
Attachments (2)
Change History (10)
comment:1 by , 14 years ago
Has patch: | unset |
---|---|
Keywords: | tutorial added |
Owner: | changed from | to
Triage Stage: | Unreviewed → Accepted |
Version: | 1.1 → SVN |
comment:2 by , 14 years ago
For newbie-friendlyness, I think all snippets in the tutorial should have all the imports included - it's only 2 or 3 in most cases anyways. I remember struggling a bit with finding the right imports, when I first did the tutorial
comment:3 by , 14 years ago
Good point, but we should probably put that into a different ticket since this, I guess, requires an OK by James.
by , 14 years ago
Attachment: | 13623.diff added |
---|
comment:4 by , 14 years ago
Has patch: | set |
---|
by , 14 years ago
Attachment: | 13623.2.diff added |
---|
comment:5 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
I updated the patch to include a closing parens so that synatx highlighting works properly.
comment:6 by , 14 years ago
This is a dupe of #14142, which was closed 'invalid'. But since a few people are obviously tripping up, it's probably worth changing it.
comment:7 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
While in general I'd agree, the snippets usually only contain the imports that are necessary for a certain example. In the examples above for views, for instance, render_to_response is not imported explicitly since the Http404 class is the only relevant import.
does not require the import since patterns was already introduced and no new function or required import is mentioned.
on the other hand might benefit from the additional import statement since "include" is "new". Surely, it was imported previously but it should be re-iterated here where this function is coming from.
If you meant the second to last snippet on that page, then I agree ;-)