Skip to content

Commit

Permalink
Use metadata if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
symroe authored and VirginiaDooley committed Apr 18, 2023
1 parent bb76a87 commit 3947a72
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% load static %}
{% load i18n %}

{% if not object.contested %}
{% if not object.contested and not object.metadata.cancelled_election %}
{% comment %} Case 1: Election cancelled, uncontested, number of candidates equal seats, no metadata{% endcomment %}
{% if object.winner_count == object.people.count %}
<h4>{% trans "Uncontested Election" %}</h4>
Expand Down Expand Up @@ -49,8 +49,14 @@ <h4>{% trans "Uncontested and Rescheduled Election" %}</h4>
{% endif %}
{% comment %} Case 4: Contested but cancelled for other reasons {% endcomment %}
{% else %}
<h4>{% trans "Cancelled Election" %}</h4>
<p>{% trans "This election was cancelled." %}</p>
{% if object.metadata.cancelled_election %}
<h4>{{ object.metadata.cancelled_election.title }}</h4>
<p>{{ object.metadata.cancelled_election.detail }}</p>
{% else %}
<h4>{% trans "Cancelled Election" %}</h4>
<p>{% trans "This election was cancelled." %}</p>
{% endif %}

{% endif %}

<p>
Expand All @@ -73,7 +79,10 @@ <h4>{% trans "Cancelled Election" %}</h4>
but rather provide extra information that is not already present in the logic
{% endcomment %}
<p>
{% if object.metadata.cancelled_election.title and object.metadata.cancelled_election.title != object.metadata.cancelled_election.description %}
{{ object.metadata.cancelled_election.title }}
{% endif %}
{% if object.metadata.cancelled_election.detail %}
{{ object.metadata.cancelled_election.detail }}
{% endif %}
</p>
</p>

0 comments on commit 3947a72

Please sign in to comment.