python - Django slice string in template doesn't work -
i'm trying slice string doesn't work. works on other variables 1 nothing.
{{b.rec_company|slice:":2"}}
you use slice pre-django 1.4:
{{b.rec_company|slice:'2'}} {{ b.rec_company|slice:":-3" }}
if using django 1.4 or greater,
you can use truncatechars
{{b.rec_company|truncatechars:2}}
for more reference use slice-string-in-template
Comments
Post a Comment