diff --git a/wcivf/apps/elections/models.py b/wcivf/apps/elections/models.py index 1feea42f1..db2bd98ba 100644 --- a/wcivf/apps/elections/models.py +++ b/wcivf/apps/elections/models.py @@ -243,6 +243,18 @@ def pluralized_division_name(self): return pluralise.get(suffix, f"{suffix}s") + @property + def has_results(self): + """ + Returns a boolean for if the election has results + """ + return bool( + self.spoilt_ballots + or self.ballot_papers_issued + or self.turnout + or self.electorate + ) + class Post(models.Model): """ diff --git a/wcivf/apps/elections/templates/elections/includes/_single_ballot.html b/wcivf/apps/elections/templates/elections/includes/_single_ballot.html index 9780500bd..209f42991 100644 --- a/wcivf/apps/elections/templates/elections/includes/_single_ballot.html +++ b/wcivf/apps/elections/templates/elections/includes/_single_ballot.html @@ -121,7 +121,7 @@

{% if postelection.is_london_assembly_additional %}{% trans "Additional memb {% endif %}

{% endif %} - {% if postelection.election.in_past %} + {% if postelection.election.in_past and postelection.election.has_results %}
@@ -135,25 +135,25 @@

{% if postelection.is_london_assembly_additional %}{% trans "Additional memb

{% if postelection.election.electorate %} {{ postelection.election.electorate }} {% else %} - {% trans "Electorate not available" %} + {% trans "None" %} {% endif %} {% if postelection.election.turnout %} {{ postelection.election.turnout|stringformat:"d%%" }} {% else %} - {% trans "Turnout not available" %} + {% trans "None" %} {% endif %} {% if postelection.election.ballot_papers_issued %} {{ postelection.election.ballot_papers_issued }} {% else %} - {% trans "Number of ballot papers issued not available" %} + {% trans "None" %} {% endif %} {% if postelection.election.spoilt_ballots %} {{ postelection.election.spoilt_ballots }} {% else %} - {% trans "Number of spoilt ballots not available" %} + {% trans "None" %} {% endif %}