diff --git a/wcivf/apps/elections/templates/elections/includes/_council_contact_details.html b/wcivf/apps/elections/templates/elections/includes/_council_contact_details.html index e2f5032de..b8defd615 100644 --- a/wcivf/apps/elections/templates/elections/includes/_council_contact_details.html +++ b/wcivf/apps/elections/templates/elections/includes/_council_contact_details.html @@ -1,18 +1,20 @@ -
- {{ contact_details.name }} - {% if contact_details.address %} - {{ contact_details.address|linebreaksbr }} - {% endif %} - {% if contact_details.postcode %} -+
+ {{ contact_details.name }} + {% if contact_details.address %} + {{ contact_details.address|linebreaksbr }} + {% endif %} + {% if contact_details.postcode %} +- {% blocktrans trimmed with registration_deadline=postelection.registration_deadline election_date=postelection.election.election_date|date:"j M Y" %} + {% blocktrans trimmed with registration_deadline=postelection.registration_deadline|naturalday:"j F Y" election_date=postelection.election.election_date|naturalday:"j F Y" %} Register before midnight on {{ registration_deadline }} to vote on {{ election_date }}. {% endblocktrans %}
-- {% if council %} - {% if council.registration_contacts %} - {% blocktrans trimmed %}To register by post, contact your Valuation Joint Board.{% endblocktrans %} - {% else %} - {% blocktrans trimmed with council_name=council.name%}To register by post, contact {{ council_name }}.{% endblocktrans %} - {% endif %} - {% else %} - {% if postelection.post.territory == "SCT" %} - {% blocktrans trimmed %}To register by post, contact your Valuation Joint Board.{% endblocktrans %} - {% else %} - {% blocktrans trimmed%}To register by post, contact your local council.{% endblocktrans %} - {% endif %} - {% endif %} - -
{% endif %} {% if council.council_id %} - - {% if council.registration_contacts %} - {% include "elections/includes/_council_contact_details.html" with contact_details=council.registration_contacts %} - -- {% blocktrans trimmed %} - For questions about your poll card, polling place, or about returning your postal voting ballot, contact your council. - {% endblocktrans %} -
- ++ {% blocktrans trimmed %} + For questions about your poll card, polling place, or about returning your postal voting ballot, contact your council. + {% endblocktrans %} +
+ {% if registration %} + {% include "elections/includes/_council_contact_details.html" with contact_details=registration %} {% endif %} - {% include "elections/includes/_council_contact_details.html" with contact_details=council.electoral_services_contacts %} - - + {% include "elections/includes/_council_contact_details.html" with contact_details=council %} {% endif %} diff --git a/wcivf/apps/elections/templates/elections/postcode_view.html b/wcivf/apps/elections/templates/elections/postcode_view.html index 166cd78c8..e5fcf40fd 100644 --- a/wcivf/apps/elections/templates/elections/postcode_view.html +++ b/wcivf/apps/elections/templates/elections/postcode_view.html @@ -53,7 +53,7 @@ {% endif %} {% if is_before_registration_deadline %} - {% include "elections/includes/_registration_details.html" with postelection=postelections.first council=polling_station.council %} + {% include "elections/includes/_registration_details.html" with postelection=postelections.0 council=council %} {% endif %} {% if not messages %} diff --git a/wcivf/apps/elections/tests/test_election_views.py b/wcivf/apps/elections/tests/test_election_views.py index ee13746ce..542f7ca48 100644 --- a/wcivf/apps/elections/tests/test_election_views.py +++ b/wcivf/apps/elections/tests/test_election_views.py @@ -393,7 +393,6 @@ def test_previous_cancelled_elections(self): self.post_election.cancelled = True self.post_election.save() response = self.client.get(self.person.get_absolute_url(), follow=True) - # import pdb; pdb.set_trace() self.assertContains(response, "{}'s elections".format(self.person.name)) self.assertContains(response, "(election cancelled") diff --git a/wcivf/apps/elections/views/mixins.py b/wcivf/apps/elections/views/mixins.py index a64bff0b4..790364baf 100644 --- a/wcivf/apps/elections/views/mixins.py +++ b/wcivf/apps/elections/views/mixins.py @@ -163,9 +163,15 @@ def is_before_registration_deadline(self, post_elections): return False election = post_elections[0].election country = post_elections[0].post.territory + if not country: country = Country.ENGLAND - + country = { + "ENG": Country.ENGLAND, + "SCT": Country.SCOTLAND, + "WLS": Country.WALES, + "NIR": Country.NORTHERN_IRELAND, + }.get(country) election = from_election_id(election_id=election.slug, country=country) event = TimetableEvent.REGISTRATION_DEADLINE return election.is_before(event) diff --git a/wcivf/apps/elections/views/postcode_view.py b/wcivf/apps/elections/views/postcode_view.py index 11e034001..fb58683bd 100644 --- a/wcivf/apps/elections/views/postcode_view.py +++ b/wcivf/apps/elections/views/postcode_view.py @@ -82,12 +82,16 @@ def get_context_data(self, **kwargs): context["show_polling_card"] = self.show_polling_card( context["postelections"] ) + context["is_before_registration_deadline"] = ( + self.is_before_registration_deadline(context["postelections"]) + ) context["people_for_post"] = {} for postelection in context["postelections"]: postelection.people = self.people_for_ballot(postelection) context["polling_station"] = self.ballot_dict.get("polling_station") context["council"] = self.ballot_dict.get("electoral_services") context["registration"] = self.ballot_dict.get("registration") + context["advance_voting_station"] = ( self.get_advance_voting_station_info(context["polling_station"]) ) @@ -106,7 +110,7 @@ def get_context_data(self, **kwargs): def future_postelections(self, postelections): """ Given a list of postelections, check if any of them are in the future - and return a list of those that are + and return True if so. """ return any( postelection @@ -350,7 +354,7 @@ def get_context_data(self, **kwargs): context["is_before_registration_deadline"] = ( PostcodeView().is_before_registration_deadline(context["postelections"]) ) - context["electoral_services"] = self.get_registration() + context["registration"] = self.get_registration() context["council"] = self.get_electoral_services() context["requires_voter_id"] = "EA-2022" context["num_ballots"] = 1