Opened 13 years ago
Closed 13 years ago
#11717 closed (duplicate)
concat default template filter
Reported by: | Alex Hayes | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.1 |
Severity: | Keywords: | concat templatetags filters | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It would be really nice to be able to concat variables or strings together within a template so that the concat'd values can be then sent into another filter. This can be done using stringformat however its not exactly that pretty and possibly prone to problems. For example:
?next={{ object.get_absolute_url|stringformat:'s#add-comment'|urlencode }}
The included patch for the file source:django/trunk/django/template/defaultfilters.py allows the following to be performed:
?next={{ object.get_absolute_url|concat:'#add-comment'|urlencode }}
I am sure that I would not be the first person to have this problem, so if there is a better solution I would be happy to hear it.
Attachments (1)
Change History (3)
Changed 13 years ago by
Attachment: | patch-11717.diff added |
---|
comment:1 Changed 13 years ago by
See also #11687 which proposes to make 'add' filter more versatile.
concat template tag.