Try {% if itineraries.items|length > 1 %} ... {% endif %} or only {% if itineraries %}
Filter in Django if template tag not working
-
27-11-2021 - |
Question
I have almost literally exactly what is in the django docs
{% if things|length > 1 %}
<div>
<span>Multiple things were found for this search criteria</span>
<button>Show All</button>
</div>
{% endif %}
And yet the div is showing up when things|length
is 0.
I'm using Django 1.3.1, so I don't know if that's the problem-- I couldn't find that information. It wasn't in the 1.4 release notes, at least.
What the heck is going on? Is this a 1.3 problem, or...?
Edit: really looks like this was introduced in 1.2 and should be working. So what's the deal?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow