summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2020-05-13 13:12:08 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2020-05-13 13:12:08 (GMT)
commitc24baefb06d7f19c1ac6b52b2df05934a03986bf (patch)
treeca8926b8247f04daed1e9434cf17beb1986cb420
parentcec2486187d073bb73772b9e69ff68e6ee1ce1b5 (diff)
downloadcombo-plugin-gnm-c24baefb06d7f19c1ac6b52b2df05934a03986bf.zip
combo-plugin-gnm-c24baefb06d7f19c1ac6b52b2df05934a03986bf.tar.gz
combo-plugin-gnm-c24baefb06d7f19c1ac6b52b2df05934a03986bf.tar.bz2
get arrondissement mairie in case of lyon city (#42813)v6.8
-rw-r--r--combo_plugin_gnm/templatetags/gnm.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/combo_plugin_gnm/templatetags/gnm.py b/combo_plugin_gnm/templatetags/gnm.py
index d82c2d0..e2f2ee2 100644
--- a/combo_plugin_gnm/templatetags/gnm.py
+++ b/combo_plugin_gnm/templatetags/gnm.py
@@ -565,8 +565,8 @@ def get_suggestions(request, user_data, places_data):
}
pollen_tile = {'key': 'pollen'}
- addresses = []
city = user_data.get('city') or user_data.get('address_city')
+ zipcode = user_data.get('zipcode') or user_data.get('address_zipcode')
if city:
# get commune tile for the user city
maplayer = MapLayer.objects.get(slug='mairie')
@@ -577,6 +577,12 @@ def get_suggestions(request, user_data, places_data):
pass
else:
city_slug = slugify(city)
+ if city_slug == 'lyon' and zipcode:
+ try:
+ city_slug = 'lyon-' + (int(zipcode) - 69000)
+ except ValueError:
+ # fallback to hotel de ville
+ city_slug = 'ville-de-lyon'
if data_result.get('features'):
for feature in data_result['features']:
if 'Annexe' in feature['properties']['nom']: