W
W
Wayne2019-12-27 20:19:18
Django
Wayne, 2019-12-27 20:19:18

Why doesn't the templating code work?

{% if post.number|add:'-2' > 0 %}
  	{{ posts.number|add:'-2' }}
  {% endif %}

post.number|add:'-2' is 1 but when I open the site {{ posts.number|add:'-2' }} is not displayed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2019-12-27
@alexkom6

post vs posts and you don't need to do this in templates, calculate in views

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question