Could someone tell me, does the method like substr in PHP (http://pl2.php.net/manual/en/function.substr.php) exist in Django templates?
You can use the slice
filter, though I don't think there's an equivalent to the $length
argument.
you can use cut
filter e.g. :
{{ value }} -> 'hello world'
{{ value|cut:'hello ' }} -> 'world'
In python, substrings are accessed as slices; there's a built-in slice filter in django.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With