From c99faa877e0f0e4fb9c1ce7939b2e369d175c301 Mon Sep 17 00:00:00 2001 From: Sym Roe Date: Sat, 18 Apr 2026 12:46:42 +0100 Subject: [PATCH] Add select related to party importer --- wcivf/apps/parties/importers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wcivf/apps/parties/importers.py b/wcivf/apps/parties/importers.py index 07e947e88..cfc57a314 100644 --- a/wcivf/apps/parties/importers.py +++ b/wcivf/apps/parties/importers.py @@ -118,7 +118,7 @@ def add_local_party(self, row, party, ballots, file_url): # only create local parties for ballots where a candidate is standing # for the parent party ballots = ballots.filter(personpost__party=party) - for post_election in ballots.distinct(): + for post_election in ballots.select_related("election").distinct(): country = self.get_country( election_type=post_election.election.election_type )