Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#10745 closed (duplicate)

url template tag should accept a varible for view name

Reported by: Soviut Owned by: Soviut
Component: Template system Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The {% url %} tag only accepts "template strings" as view name/named url. I propose that the view name be a django.template.Variable and resolve() on render.

There are two reasons for this; Firstly, if you accidentally put quotes around the view name a very cryptic template syntax error is raised. Secondly, I've encountered several occasions where it would be useful to be able to pass a view name, or named url, to the url tag as a variable, but found it wouldn't evaluate.

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 (6)

comment:1 Changed 8 years ago by Soviut

Owner: changed from nobody to Soviut
Status: newassigned

Changed 8 years ago by Soviut

patch proposal

comment:2 Changed 8 years ago by Soviut

Has patch: set

comment:3 Changed 8 years ago by Johannes Dollinger

This has already been rejected, see #7917 (option number 2 there would be a backwards compatible fix for your quote issue).

You could raise this on django-dev (once again) when 1.1 is out the door.

Good luck.

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

Resolution: duplicate
Status: assignedclosed

Duplicate of #7917.

comment:5 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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