I want to use more than one filter on template like below:
value: {{ record.status|cut:"build:"|add:"5" }}
where record.status would be build:n, 0 < n< 100
but I want to add this value a base value 5.
I tried above code, it only take effect on the first filter,
so I did not get the value plus 5.
Does django only support one filter?
Thanks
First, the answer for your question “Does django only support one filter?” is that
Django does support almost unlimited number of chained filters (depends on your platform and ability to write that number of chained filters of course =) . Take some code for example (not proof but it makes sense), it is actually a template
'{{ x|add:1|add:1|...10000 in all...|add:1 }}'Second, please check the template to ensure that you are using built-in version of
cutandadd; also check the output value after thecutto ensure it can be coerced to int w/o raising exception.I’ve just checked and found that even the Django 0.95 supports this usage: