Opened 16 years ago

Closed 15 years ago

Last modified 13 years ago

#7917 closed (invalid)

Decide whether {% url %} syntax changes

Reported by: Johannes Dollinger Owned by: nobody
Component: Template system Version: dev
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: no UI/UX: no


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 15 years ago.
patch proposal

Download all attachments as: .zip

Change History (11)

comment:1 by Johannes Dollinger, 16 years ago

Triage Stage: UnreviewedDesign decision needed

comment:2 by anonymous, 16 years ago

Cc: justinlilly@… added

comment:3 by Trevor Caira, 16 years ago

Cc: Trevor Caira added

comment:4 by Malcolm Tredinnick, 16 years ago

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 by Johannes Dollinger, 16 years ago

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 by Ulrich Petri, 15 years ago

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 by Russell Keith-Magee, 15 years ago

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.

by Soviut, 15 years ago

patch proposal

comment:8 by Soviut, 15 years ago

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 by Alex Gaynor, 15 years ago

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 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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