Opened 13 years ago

Closed 13 years ago

#17383 closed Cleanup/optimization (wontfix)

template filter arguments don't tolerate whitespace

Reported by: adrian_nye@… Owned by: nobody
Component: Template system Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This generates an error:

{{ today|date: "SHORT_DATE_FORMAT" }}

but this doesn't:

{{ today|date:"SHORT_DATE_FORMAT" }}

Since there is a colon ending the filter name and a quote beginning the argument, it seems like the whitespace could be ignored. This would make the template easier to read and use, which is especially important in the templates since this is where non-programmers are most likely to be contributing.

Change History (1)

comment:1 by Aymeric Augustin, 13 years ago

Resolution: wontfix
Status: newclosed

I understand your proposal but I think it makes chained filters harder to read: {{ var|cook: "spam"|fry: "eggs" }}.

Also, for the sake of consistency throughout the Django ecosystem, it's better to have only one syntax, and the current one is good enough.

I believe a project like Django has to make these aesthetic choices early, and then stick with them. In other words, when you build the nuclear plant, you're allowed to chose the color of the bike shed :)

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