1 2 3 | @register.filter
def slice(s, delimiter=' '):
return s.slice(delimiter)
|
More like this
- render_as_template template tag by cogat 4 years, 3 months ago
- truncatestring filter by pigletto 4 years, 3 months ago
- Humanize lists of strings in templates by ChipX86 6 years ago
- Akismet Webservice by sneeu 6 years, 3 months ago
- Lightweight querysets by sardarnl 2 days, 17 hours ago
Comments
The name "slice" conflicts with the built-in "slice" filter. I'd definitely recommend anyone who use this change the name, or you could be headed for troubled.
#
Yeah, I'm not sure this works at all... strings don't have a "slice" method, so likely this doesn't do anything except throw an error.
#
Did you mean split?
#
Ah yes, sorry - it should be called split.
#