Баг фикс

main
through-your-tears 9 months ago
parent 577ba0a866
commit d13b12839c

@ -42,15 +42,18 @@ MAPPING_DATA = {
def parse_organizations_to_db(data): def parse_organizations_to_db(data):
for k in data.keys(): for k in data.keys():
for obj in data[k]: for obj in data[k]:
OrganizationRepository.create( try:
location=LocationRepository.get_or_create( OrganizationRepository.create(
coords=Point(float(obj['latitude']), float(obj['longitude'])), location=LocationRepository.get_or_create(
address=obj['street'] + obj['housenumber'] coords=Point(float(obj['latitude']), float(obj['longitude'])),
), address=obj['street'] + obj['housenumber']
name=obj['name'], ),
phone=obj['phone'], name=obj['name'],
website=obj['website'], phone=obj['phone'],
description=obj['description'], website=obj['website'],
category=CategoryRepository.get_by_name(MAPPING_DATA[obj['category']]) description=obj['description'],
) category=CategoryRepository.get_by_name(MAPPING_DATA[obj['category']])
)
except Exception:
pass

Loading…
Cancel
Save