Variable subtraction in django templates
You need to use double quotes:
{{ myval|add:"-5" }}
This subtracts five from myval
.
The built-in Django template tags/filters aren't all-encompassing, but it's super easy to write your own custom template tags: https://docs.djangoproject.com/en/dev/howto/custom-template-tags/
You could make your own subtract
template tag pretty easily:
@register.filter
def subtract(value, arg):
return value - arg