Opened 6 years ago

Closed 6 years ago

Last modified 4 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 6 years ago.
patch proposal

Download all attachments as: .zip

Change History (6)

comment:1 Changed 6 years ago by Soviut

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to Soviut
  • Patch needs improvement unset
  • Status changed from new to assigned

Changed 6 years ago by Soviut

patch proposal

comment:2 Changed 6 years ago by Soviut

  • Has patch set

comment:3 Changed 6 years ago by emulbreh

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 6 years ago by russellm

  • Resolution set to duplicate
  • Status changed from assigned to closed

Duplicate of #7917.

comment:5 Changed 4 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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