diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-03-12 10:22:09 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-04-24 19:41:37 +0200 |
commit | eca590207394bc4c257ea47a5f00de2f9de579f6 (patch) | |
tree | 8023f53739bb7df39419fadf122ce52da4af09bd | |
parent | f9620956381f843fc5d341fd19cdf0fc0f68d1a7 (diff) | |
download | Ishtar-eca590207394bc4c257ea47a5f00de2f9de579f6.tar.bz2 Ishtar-eca590207394bc4c257ea47a5f00de2f9de579f6.zip |
Admin - Geojson update: add an option to update only geom
-rw-r--r-- | ishtar_common/admin.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py index 9ad8f304e..df2ea399f 100644 --- a/ishtar_common/admin.py +++ b/ishtar_common/admin.py @@ -421,6 +421,10 @@ class ImportGeoJsonForm(forms.Form): year_name = forms.CharField( label=_(u"Field name for year"), max_length=200, required=False ) + update = forms.BooleanField( + label=_(u"Update only geometry of existing towns"), required=False, + widget=forms.CheckboxInput + ) class ImportGEOJSONActionAdmin(object): @@ -552,6 +556,7 @@ class ImportGEOJSONActionAdmin(object): "name_name": request.POST.get('name_name'), "surface_name": request.POST.get('surface_name', "") or "", "year_name": request.POST.get('year_name', "") or "", + "update": request.POST.get('update', "") or "", "insee_prefix": request.POST.get('numero_insee_prefix', None) or '', "surface_unit": int(request.POST.get('surface_unit')) @@ -593,6 +598,9 @@ class ImportGEOJSONActionAdmin(object): else: modified = False for k in values: + if not keys['update'] and k not in ["center", + "limit"]: + continue if values[k] != getattr(t, k): setattr(t, k, values[k]) modified = True |