Opened 6 years ago

Last modified 6 years ago

#29433 closed New feature

templatefilter "make_list" should receive a optional split variable — at Version 1

Reported by: Maxim Danilov Owned by: nobody
Component: Template system Version:
Severity: Normal Keywords: templatefilter,
Cc: Jeff Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Tim Graham)

for use in template, for example:
not only

{% with my_list='i#am#stupid#user'|make_list %}
# my_list=['i','#','a','m','#','s','t','u','p','i','d','#','u','s','e','r']

......

it should to work too:

{% with my_list='i#am#stupid#user'|make_list:'#' %}
# my_list=['i','am','stupid','user']

......

Change History (1)

comment:1 by Tim Graham, 6 years ago

Description: modified (diff)

I'm on the fence. While I see the value, I'm not sure that promoting more logic in templates in a good idea. It's fairly easy to write a custom filter (I would call it "split") which I think would be more readable.

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