Slice filter

1
2
3
@register.filter
def slice(s, delimiter=' '):
    return s.slice(delimiter)

More like this

  1. render_as_template template tag by cogat 4 years, 3 months ago
  2. truncatestring filter by pigletto 4 years, 3 months ago
  3. Humanize lists of strings in templates by ChipX86 6 years ago
  4. Akismet Webservice by sneeu 6 years, 3 months ago
  5. Lightweight querysets by sardarnl 2 days, 17 hours ago

Comments

jcroft (on March 6, 2007):

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.

#

jacobian (on March 6, 2007):

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.

#

whiskybar (on March 7, 2007):

Did you mean split?

#

sneeu (on March 14, 2007):

Ah yes, sorry - it should be called split.

#

(Forgotten your password?)