2
The syntax of else
is not correct:
{% else sort_by == "vehicle_year" %}
Replace it with just {% else %}
.
0
You can’t put a condition on an else
clause. As in normal Python, if you have a further condition, you need to use elif
.
{% if sort_by == "last_updated" %}
...
{% elif sort_by == "vehicle_year" %}
...
{% else %}
...
{% endif %}
- [Answered ]-Django Migrate : TypeError: int() argument must be a string or a number, not 'User'
- [Answered ]-Histograms on SQL in Django QuerySet Annotation / Aggregation
- [Answered ]-Manually enter a value in django model form
- [Answered ]-How can I write my own OrderedDict class in Python?
Source:stackexchange.com