Commit 94bf3c4f authored by okhin's avatar okhin 🚴

Let's add a filter for Multiple Constituency because nationalist have alack of imagination.

parent 1ce7d64d
......@@ -301,6 +301,11 @@ class ParltrackImporter(GenericImporter):
except Constituency.DoesNotExist:
constituency = Constituency(name=local_party)
save_constituency = True
except Constituency.MultipleObjectsReturned:
# There is more than one constituency with that name.
# We must filter them by country.
constituency = Constituency.objects.get(name=local_party,
country_id=country_id)
if constituency.country_id != country_id:
constituency.country_id = country_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment