From 11a1928346085c7dd7f5bf004daaf3530ce723e3 Mon Sep 17 00:00:00 2001 From: littlewolf Date: Thu, 31 Oct 2019 08:49:17 +0300 Subject: [PATCH] Add MultipkleObjects exception --- apps/establishment/transfer_data.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/establishment/transfer_data.py b/apps/establishment/transfer_data.py index 2b45c388..8366ed94 100644 --- a/apps/establishment/transfer_data.py +++ b/apps/establishment/transfer_data.py @@ -117,6 +117,8 @@ def transfer_establishment_addresses(): try: location = Address.objects.get(old_id=old_establishment.location_id) + except Address.MultipleObjectsReturned: + location = Address.objects.filter(old_id=old_establishment.location_id).first() except Address.DoesNotExist: continue