lundi 4 avril 2016

If statement template in Django

I'm trying to create an if-statement to display if event type is online or in person. if its online then automatically display online, if not its gonna display location

<div class='upcoming_events'>
    {% for event in page.get_upcoming_events %}
        <div>
        {{ event.title }}
            <p>
                {{ event.start}} | 
                {% if event_type == Online}
                    Online
                {% elif event_type == "In Person" %}
                    {{ event.location }}
                {% endif %}
            </p>    
                <p><a href="http://www.google.com">Read more</a></p>
        </div>
    {% endfor %}
    </div>

im getting error saying " Invalid block tag on line 54: 'elif', expected 'empty' or 'endfor'. "

how can i resolve issue?

Aucun commentaire:

Enregistrer un commentaire