1👍
There are two mistakes here:
- a template tag, like
{% if … %}
[Django-doc] is wrapped in curly brackets with percentages ({% … %}
), you are missing the percentages (%
); and - a string literal is wrapped between quotes, so
'red'
, instead of.red
You thus implement this with:
<td {% if car.color == 'red' %}style="background-color: red;"{% endif %}>{{car.color}}</td>
Source:stackexchange.com