I created dynamic slider using bootstrap. I want to show number indicator for slider, so I added one to variable in forloop. But I m getting the following error "TemplateSyntaxError at / Could not parse the remainder: ' + 1' from 'forloop.counter0 + 1'".
Custom Filter Example:
This is just an example for custom filter.
Resolve with custom filter:
In django, we cannot perform arithmetic operations using template tags. To achieve this I created a custom template filter.
Create a folder named "templatetags" in django app and create a empty file named "__init__.py" inside the folder. Then,
Create a template filter in django app, "Custom_filters.py".
Copy and pasted below code:
In Html Template, load the custom filter at the top of the template.
Use the custom filter to add 1 to the 'forloop.counter'