1 2 3 | @register.filter
def slice(s, delimiter=' '):
return s.slice(delimiter)
|
More like this
- truncatestring filter by pigletto 4 years, 2 months ago
- Humanize lists of strings in templates by ChipX86 5 years, 11 months ago
- Akismet Webservice by sneeu 6 years, 2 months ago
- a simple tag with context by dsblank 3 years, 5 months ago
- Generate Javascript-Safe string in template by Spike^ekipS 6 years, 2 months 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.
#