Django substr / substring in templates

Krzysztof Trzos picture Krzysztof Trzos · Aug 31, 2011 · Viewed 19.6k times · Source

Could someone tell me, does the method like substr in PHP (http://pl2.php.net/manual/en/function.substr.php) exist in Django templates?

Answer

Ismail Badawi picture Ismail Badawi · Aug 31, 2011

You can use the slice filter, though I don't think there's an equivalent to the $length argument.