Opened 15 years ago

Closed 15 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)

patch-11717.diff (1.1 KB ) - added by Alex Hayes 15 years ago.
concat template tag.

Download all attachments as: .zip

Change History (3)

by Alex Hayes, 15 years ago

Attachment: patch-11717.diff added

concat template tag.

comment:1 by dc, 15 years ago

See also #11687 which proposes to make 'add' filter more versatile.

comment:2 by dc, 15 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #8088

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