Commit 0ec446a2 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 !210
parents e3889c4f 2babadeb
Pipeline #1091 passed with stage
in 10 minutes and 23 seconds
...@@ -11,6 +11,7 @@ from django.apps import apps ...@@ -11,6 +11,7 @@ from django.apps import apps
from django.db import transaction from django.db import transaction
from django.utils import timezone from django.utils import timezone
from django.utils.text import slugify from django.utils.text import slugify
from django.core.exceptions import MultipleObjectsReturned
from representatives.models import (Address, Constituency, Country, Email, from representatives.models import (Address, Constituency, Country, Email,
Group, Mandate, Phone, Representative, Group, Mandate, Phone, Representative,
...@@ -301,7 +302,7 @@ class ParltrackImporter(GenericImporter): ...@@ -301,7 +302,7 @@ class ParltrackImporter(GenericImporter):
except Constituency.DoesNotExist: except Constituency.DoesNotExist:
constituency = Constituency(name=local_party) constituency = Constituency(name=local_party)
save_constituency = True save_constituency = True
except Constituency.MultipleObjectsReturned: except MultipleObjectsReturned:
# There is more than one constituency with that name. # There is more than one constituency with that name.
# We must filter them by country. # We must filter them by country.
constituency = Constituency.objects.get(name=local_party, constituency = Constituency.objects.get(name=local_party,
......
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