Commit 44f01b6a authored by okhin's avatar okhin 🚴

Merge branch '185-import-process-crashes-with-to-bogus-json-entry' into 'master'

Resolve "Import process crashes with to "bogus" json entry"

Closes #185

See merge request !209
parents 1ce7d64d 94bf3c4f
......@@ -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