Opened 15 years ago
Closed 15 years ago
#11462 closed (worksforme)
{% url %} tag is not working with the 'AS' modifier and named URLs
Reported by: | x13 | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I've included this lines into my urls.py
... url(r'^coming-soon$', direct_to_template, {'template': 'soon.html'}, name='en-soon'), url(r'^proximamente$', direct_to_template, {'template': 'soon.html'}, name='es-soon'), ...
Then, I tried to use them in my homepage.html with the {% url ... as ... %} tag:
... {% url en-soon as url_soon %} <a href="{{ url_soon }}">comming soon</a> ...
but it didn't work.
Next, I tried use {% url %} without the as modifier:
... <a href="{% url en-soon %}">comming soon</a> ...
and it worked.
Note:
See TracTickets
for help on using tickets.
What do you mean with it didn't work? I tested this with Django 1.0, 1.0.2 and trunk and it worked as expected (the alias variable evaluates to the correct URL for the link href). Reopen the ticket if you are willing to provide more details about your setup and exact failure.
PS: I used this template fragment: