Opened 12 years ago
Closed 12 years ago
#18762 closed Uncategorized (fixed)
Problem with url in templates
Reported by: | Owned by: | Aymeric Augustin | |
---|---|---|---|
Component: | Documentation | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This:
<li><a href="{% url 'polls.views.detail' poll.id %}">{{ poll.question }}</a></li>
...does not work.
But this:
<li><a href="{% url polls.views.detail poll.id %}">{{ poll.question }}</a></li>
....does.
Change History (11)
comment:1 by , 12 years ago
Type: | Uncategorized → Cleanup/optimization |
---|
comment:2 by , 12 years ago
Type: | Cleanup/optimization → Bug |
---|
This tells me:
python -c "import django; print(django.get_version())"
...that I am running "1.4.1"
comment:3 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
The 1.4.X release branch still rely on the old behaviour by default.
I guess your report is against this part of the development version documentation. If you want this to work in 1.4.1 you must add a {% load url from future %}
at the top of your template.
Again, I advise you to read the django 1.3 release note explaining this to understand why you encounter this error.
comment:4 by , 12 years ago
Type: | Bug → Uncategorized |
---|
Thanks for clarifying!
I had started with the Tutorial from the Django homepage and later googled to look up the Tutorial page I had been on last and ended up on the "dev" version of the documenation and as both look absolutely similar i didn't recognize that there are two versions of the tutorial ...I am sure I'll not be the only one falling for this, as the only difference is the additional "/dev" in the page URL.
Kudos btw to the person who wrote the Tutorial! One of the best I've ever seen.
comment:6 by , 12 years ago
I think the /dev/ documentation would read better if it had the
{% load url from future %}
bit listed right above the
url 'polls.views.detail' poll.id
line if that's the way apps from 1.4 onward should be done.
As it is written everyone's going to run into the NoReverseMatch error page, look at the warning in the docs and become confused when it says that you're running a version < 1.4 when they are running 1.4.1.
comment:7 by , 12 years ago
{% load url from future %}
was only a transition tool. It isn't necessary in 1.5 any more.
For me ≤ 1.4 includes all the releases in the 1.4 series. I suppose it would be clearer to write < 1.5?
comment:8 by , 12 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
comment:9 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
comment:10 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:11 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Hi jendxb!
You are likely reading development version documentation while using a version of django <= 1.4.
The old behaviour of the
url
template tag will be officially deprecated in django 1.5 following the deprecation process described in the django 1.3 release note.You should really convert your templates to use the new behaviour by adding the
{% load url from future %}
statement at the top of then.Thanks for reporting anyway.