Opened 7 years ago

Closed 7 years ago

#11717 closed (duplicate)

concat default template filter

Reported by: zanuxzan 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: UI/UX:


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/ 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 zanuxzan 7 years ago.
concat template tag.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by zanuxzan

concat template tag.

comment:1 Changed 7 years ago by dc

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

comment:2 Changed 7 years ago by dc

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

Duplicate of #8088

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