django template else if code example

Example 1: else if in django template

Your {% elif %} in {% if my video...%} doesn't have any condition.

I think you should have {% else %} instead?

{% if my_video %}//if that url is an link to video
    <img src="{{ my_video.thumbnail }}" class="img-rounded" alt="" height="75" width="75"/>
{% else %} //if that url isn't a video
    <img src="{{post.image}}"  class="img-rounded" alt=" EBAGU" height="75" width="75"/>
{% endif %}

Example 2: if condition in djangio template

{% if athlete_list %}
    Number of athletes: {{ athlete_list|length }}
{% elif athlete_in_locker_room_list %}
    Athletes should be out of the locker room soon!
{% else %}
    No athletes.
{% endif %}