Opened 6 years ago

Closed 6 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: UI/UX:

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.

Change History (1)

comment:1 Changed 6 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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.

Note: See TracTickets for help on using tickets.
Back to Top