#4355 closed (fixed)
Confusing example in documentation for url template tag
Reported by: | Owned by: | Jacob | |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Keywords: | ||
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
The documentation for the url template tag shows it linking to a view as 'app_name.client' which would require a very abnormal project setup to be valid - because of this, it can be confusing to newer django users - I was helping someone on IRC that thought the tag did some translation from app.viewname to project.app.views.viewname :)
Attachments (2)
Change History (12)
by , 18 years ago
Attachment: | url-doc.patch added |
---|
comment:1 by , 18 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
follow-up: 4 comment:2 by , 18 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
Leave the project name out of the change, though, that makes things less portable (because if you move the app to somewhere else on your Python path, you have to change every URLConf entry that refers to it). Including "viewe" makes sense, though.
follow-up: 5 comment:3 by , 18 years ago
project_name is used elsewhere though, including in that very same example (the include line) - should that be changed also?
comment:4 by , 18 years ago
Replying to mtredinnick:
Leave the project name out of the change, though, that makes things less portable (because if you move the app to somewhere else on your Python path, you have to change every URLConf entry that refers to it). Including "viewe" makes sense, though.
I agree that including the project name makes things less portable but starting at the tutorial 01 http://www.djangoproject.com/documentation/tutorial01/#playing-with-the-api we are telling newcomers to include it (mysite in this case) so we should a) recommend it b) don't do it. But being consistent as much as possible on all the docs/
I'd rather go for the "do not recommend including the project name on imports" but on the whole docs ;)
Anyway, updated patch follows.
follow-up: 7 comment:5 by , 18 years ago
Replying to Collin Grady <cgrady@the-magi.us>:
project_name is used elsewhere though, including in that very same example (the include line) - should that be changed also?
You're right, project_name is used in the middle of the section the patch correct which makes it sound strange. Let's let triagers decide whether to apply the first patch or making a new one changing all project_name references on templates.txt
(which means: do not apply the second patch as it makes the section sound strange''')
comment:6 by , 18 years ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Consistency is good. I say apply the first patch and open a new ticket to remove the project_name
references throughout the templates doc file.
comment:7 by , 18 years ago
Replying to Marc Fargas <telenieko@telenieko.com>:
... decide whether to apply the first patch or making a new one changing all project_name references on templates.txt
The only other reference to project_name in that whole file is in a completely different context: it's two lines later showing how the project-wide !URLConf file might include the app-specific !URLConf. Not a bad place to use the project name.
There's no inconsistency at all here (tutorials are not the same as reference document; don't conflate the two). Using project name sometimes and not others is not a disaster. Certainly not in this case.
comment:8 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:9 by , 18 years ago
But won't only one of the two methods work depending on your pythonpath setup? (unless you're in a file in the project root)
Seems like an important bit of inconsistency :)
comment:10 by , 18 years ago
The first line is in the app dir, the second line is in the project's URL conf -- that is clear in the example -- so both have their own directory in their effective Python import path. The docs say "if is is included like this", setting up the precondition. It doesn't say you have to import it like that. We are not spoon-feeding here, intentionally; that drags down the quality of the docs for the other 90% of readers. If somebody need to stop and think for a minute to get the example straight, no harm is done.
There really are far more important problems to fix than going around and around on this. Let's move on, please.
Yes, it's better to stay consistent across the documentation!