Reputation: 1
The fourth elif statement is the one causing me the issue. I have swapped the third elif statement with the fourth and every time the fourth is in third place it works.
{% block content%}
{% load static %}
<link rel="stylesheet" href="{% static 'css/home_page.css' %}">
<link rel="stylesheet" href="{% static 'css/home_w_d_cs.css' %}">
{% if first_hour_d == 'clear sky' and time_of_day == True %} <!-- day == True means day -->
<div class="side-hour-icon">
<img src="{% static 'images/sunny-black.png' %}" alt="" width="55" height="50">
</div>
{% elif first_hour_d == 'clear sky' and time_of_day == False %} <!-- day == False means night -->
<div class="side-hour-icon">
<img src="{% static 'images/clear-night-black.png' %}" alt="" width="55" height="50">
</div>
{% elif first_hour_d == 'overcast clouds' or 'broken clouds' %}
<div class="side-hour-icon">
<img src="{% static 'images/cloudy2.png' %}" alt="" width="55" height="50">
</div>
{% elif first_hour_d == 'few clouds' or 'scattered clouds' %}
<div class="side-hour-icon">
<img src="{% static 'images/few-clouds-black.png' %}" alt="" width="55" height="50">
</div>
{% endif %}
{% endblock %}
I want to have a few elif statements, maybe 10 or 12. Is this possible?
Upvotes: 0
Views: 360
Reputation: 3700
You can't do:
{% elif first_hour_d == 'overcast clouds' or 'broken clouds' %}
because the second string will always evaluate to True
.
You must do:
{% elif first_hour_d == 'overcast clouds' or first_hour_d == 'broken clouds' %}
Upvotes: 1