Commit 2babadeb authored by Okhin's avatar Okhin
Browse files

Catching the correct exceptions

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