From 972359c931baf66cbaeda9b3df92ff2a6b62ea3e Mon Sep 17 00:00:00 2001 From: through-your-tears Date: Sat, 6 Apr 2024 19:19:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=D1=8B=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/organizations/services.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/organizations/services.py b/src/organizations/services.py index 1cef77a..abf7e77 100644 --- a/src/organizations/services.py +++ b/src/organizations/services.py @@ -42,14 +42,17 @@ MAPPING_DATA = { def parse_organizations_to_db(data): for k in data.keys(): for obj in data[k]: - OrganizationRepository.create( - location=LocationRepository.get_or_create( - coords=Point(obj['latitude'], obj['longitude']), - address=obj['address'] - ), - name=obj['name'], - phone=obj['phone'], - website=obj['website'], - description=obj['description'], - category=CategoryRepository.get_by_name(MAPPING_DATA[obj['category']]) - ) + try: + OrganizationRepository.create( + location=LocationRepository.get_or_create( + coords=Point(obj['latitude'], obj['longitude']), + address=obj['address'] + ), + name=obj['name'], + phone=obj['phone'], + website=obj['website'], + description=obj['description'], + category=CategoryRepository.get_by_name(MAPPING_DATA[obj['category']]) + ) + except Exception: + pass