Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#7917 closed (invalid)

Decide whether {% url %} syntax changes

Reported by: Johannes Dollinger Owned by: nobody
Component: Template system Version: master
Severity: Keywords:
Cc: justinlilly@…, Trevor Caira Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Doc quote: "Note that the syntax for this tag may change in the future, as we make it more robust."

Recent django-dev thread:


  1. Make the view name a normal Variable. Backwards incompatible: old {% url foo %} vs new {% url "foo" %}
  2. Accept a quoted view name, deprecate unquoted view names. Backwards compatible. This would enable a soft transition to solution 1.
  3. Treat an unquoted view name as a literal, unless reverse fails. Then try to treat it as a Variable. Backwards incompatible (strange things might happen). Proposed here:
  4. ???
  5. Do nothing.

Attachments (1)

url-tag-variable-view-name.diff (1.2 KB) - added by Soviut 8 years ago.
patch proposal

Download all attachments as: .zip

Change History (11)

comment:1 Changed 8 years ago by Johannes Dollinger

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 8 years ago by anonymous

Cc: justinlilly@… added

comment:3 Changed 8 years ago by Trevor Caira

Cc: Trevor Caira added

comment:4 Changed 8 years ago by Malcolm Tredinnick

Resolution: invalid
Status: newclosed

Let's just leave this as a mailing list thread, since that's the resolution of the ticket. A decision has been made and the current thread is only saying some people want to go over it again. No new convincing arguments have been made. As mentioned in the most recent thread, this has been discussed on django-dev at least twice before and both times the resolution has been "no change". So that's where it stays for now. Unless you can get Adrian or Jacob to have a strong opinion to change it now, nothing will happen.

comment:5 Changed 8 years ago by Johannes Dollinger

Adrian, Jakob, the powers that be, I call you!

Unless you have a strong opinion to leave everything as is, {% url %} syntax should change.

comment:6 Changed 8 years ago by Ulrich Petri

Resolution: invalid
Status: closedreopened

In light of the recent acceptance of #9666 I think this ticket should be reconsidered as well.

If it is acceptable to "silently" modify the SSI tag to try context variable resolution first I think this change is much the same. Even the patch would be nearly identical.

Being able to use a context variable has many uses (e.g. in a generic pagination tag wich could take the view name as a parameter).

comment:7 Changed 8 years ago by Russell Keith-Magee

Resolution: invalid
Status: reopenedclosed

If you disagree with a decision that has been made by a core developer, don't just re-open the ticket - you need to start a discussion on django-developers.

Changed 8 years ago by Soviut

patch proposal

comment:8 Changed 8 years ago by Soviut

Has patch: set
milestone: 1.0 beta1.1

I added a patch that seems to do the trick. From what I can tell, this doesn't break anything since literal strings, quoted strings and context variables all evaluate correctly using Variable().

comment:9 Changed 8 years ago by Alex Gaynor

This ticket has already been closed by a core developer, barring a chance in their decision it will not be included in Django.

comment:10 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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