Opened 15 years ago
Closed 15 years ago
#11835 closed (invalid)
url template tag doesn't put anything if the keyword argument has ' ', '&', '\' kind of characters
Reported by: | manasgarg | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | 1.1 |
Severity: | Keywords: | url, template tag | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hello,
I noticed that the url template tag returns blank if any of the keyword arguments has characters which require quoting. The behavior is consistent even if the keyword argument has been quoted.
How to reproduce:
Let's say, I have the following in url pattern:
(r'images/tags/(?P<tag_name>\w+)$', 'images.views.image_tag_viewer'),
Now, when I say:
{% url images.views.image_tag_viewer tag_name=tag.name as tag_url %}
And if tag.name has any of the special characters (which need to be quoted in a url), tag_url will be set as blank.
That's because your regex doesn't match those characters. Please don't use the Django tracker for technical support, use either the django-users mailing list or the #django channel on freenode.