I am working with Django
Mezannine
and I am running into a weird issue with jinja.
TemplateSyntaxError at /services/
Could not parse the remainder: '%' from '%'
Request Method: GET
Request URL: http://192.168.1.14/services/
Django Version: 1.8.3
Exception Type: TemplateSyntaxError
Exception Value:
Could not parse the remainder: '%' from '%'
Exception Location: /usr/local/lib/python3.4/dist-packages/django/template/base.py in __init__, line 639
Python Executable: /usr/bin/python3
Python Version: 3.4.3
My code looks something like below:
{% for image in images %}
{% if loop.index % 3 == 0 %} #this is the line it doesn't like
{{image}}
{% endif %}
{% endfor %}
Any idea what is going on here?
Thanks
% is reserved by Django so you have to use divisibleby
{% for image in images %}
{% if forloop.counter|divisibleby:"3" %}
{{image}}
{% endif %}
{% endfor %}
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