Reformat establishment elastic location for api

This commit is contained in:
Kuroshini 2019-09-26 17:46:07 +03:00
parent e0d09486c2
commit fec3a2f6bc

View File

@ -86,7 +86,12 @@ class EstablishmentDocumentSerializer(DocumentSerializer):
if ret.get('address'):
ret['address']['city']['country']['name_translated'] = get_translated_value(
ret['address']['city']['country'].pop('name'))
location = ret['address'].pop('location')
if location:
ret['address']['geo_lon'] = location['lon']
ret['address']['geo_lat'] = location['lat']
ret['type'] = ret.pop('establishment_type')
ret['subtypes'] = ret.pop('establishment_subtypes')
return ret