Opened 7 years ago
Closed 6 years ago
#29433 closed New feature (wontfix)
templatefilter "make_list" should receive a optional split variable
Reported by: | Maxim Danilov | Owned by: | Prakash |
---|---|---|---|
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 )
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 (9)
follow-ups: 2 3 comment:1 by , 7 years ago
Description: | modified (diff) |
---|
comment:2 by , 7 years ago
I feel somewhat ambivalent about this as well. If we decide to add the split feature, would it make more sense to add a new tag "split" instead of changing the behavior or "make_list" Do we want to add this at all?
Replying to Tim Graham:
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.
comment:3 by , 7 years ago
Cc: | added |
---|
I feel somewhat ambivalent about this as well. If we decide to add the split feature, would it make more sense to add a new tag "split" instead of changing the behavior of "make_list". Do we want to add this at all?
Replying to Tim Graham:
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.
comment:5 by , 6 years ago
I also think that adding a split
filter (there's already a join
filter) is useful. Sometimes we store lists of strings in simple CharFields and for display we need to replace the separator with a more human-friendly separator.
So, who's going to decide if it shall be added?
comment:6 by , 6 years ago
Triage Stage: | Unreviewed → Someday/Maybe |
---|
Write to the DevelopersMailingList to get a consensus about how to proceed.
comment:9 by , 6 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
Closing as the mailing list didn't yield consensus to add this.
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.