diff --git a/wcivf/apps/elections/dummy_models.py b/wcivf/apps/elections/dummy_models.py index bb2d056d6..3a39d85a2 100644 --- a/wcivf/apps/elections/dummy_models.py +++ b/wcivf/apps/elections/dummy_models.py @@ -1,21 +1,32 @@ from datetime import date from random import randint -from elections.models import Election, Post, PostElection +from elections.models import Election, Post, PostElection, VotingSystem from people.dummy_models import DummyCandidacy, DummyPerson class DummyPostElection(PostElection): party_ballot_count = 5 display_as_party_list = False + locked = True + voting_system_id = "FPTP" + ballot_paper_id = "local.faketown.made-up-ward.2024-05-31" + cancelled = False + show_polling_card = True + contested = True + requires_voter_id = "EA-2022" election = Election( name="Llantalbot local election", - election_date=date(2022, 5, 5), + election_date=date(2024, 5, 31), any_non_by_elections=True, - slug="local.faketown.2022-05-05", + slug="local.faketown.2024-05-31", + voting_system=VotingSystem(slug="FPTP"), + current=True, ) + post = Post(label="Made-Up-Ward") + post.territory = "ENG" pk = randint(1, 100000) class Meta: @@ -23,7 +34,7 @@ class Meta: def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.ballot_paper_id = "local.faketown.made-up-ward.2022-05-05" + self.ballot_paper_id = "local.faketown.made-up-ward.2024-05-31" self.election.get_absolute_url = self.election_get_absolute_url def election_get_absolute_url(self): diff --git a/wcivf/apps/elections/views/postcode_view.py b/wcivf/apps/elections/views/postcode_view.py index bf7fc1650..13286da01 100644 --- a/wcivf/apps/elections/views/postcode_view.py +++ b/wcivf/apps/elections/views/postcode_view.py @@ -319,6 +319,7 @@ def get(self, request, *args, **kwargs): class DummyPostcodeView(PostcodeView): postcode = None + uprn = None def get(self, request, *args, **kwargs): kwargs["postcode"] = self.postcode @@ -329,12 +330,40 @@ def get_context_data(self, **kwargs): context = kwargs self.postcode = clean_postcode(kwargs["postcode"]) context["postcode"] = self.postcode + self.uprn = self.kwargs.get("uprn") + context["uprn"] = self.uprn + context["postelections"] = self.get_ballot_dict() context["show_polling_card"] = True - context["polling_station"] = {} + context["polling_station"] = self.get_polling_station() + context["requires_voter_id"] = "EA-2022" context["num_ballots"] = 1 - return context def get_ballot_dict(self): return [DummyPostElection()] + + def get_polling_station(self): + return { + "polling_station_known": True, + "custom_finder": False, + "report_problem_url": "http://wheredoivote.co.uk/report_problem/?source=testing&source_url=testing", + "station": { + "id": "w06000015.QK", + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-3.119229, 51.510885], + }, + "properties": { + "address": "1 Made Up Street\nMade Up Town\nMade Up County", + "postcode": "MA1 1AA", + }, + }, + "geometry": { + "coordinates": [-0.127758, 51.507351], + }, + "properties": { + "address": "1 Made Up Street\nMade Up Town\nMade Up County", + }, + }