summaryrefslogtreecommitdiff
path: root/ishtar_common/admin.py
diff options
context:
space:
mode:
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
commita3648dfd62e28488737866385aa56dadf1df0d69 (patch)
tree8023f53739bb7df39419fadf122ce52da4af09bd /ishtar_common/admin.py
parente199d50cd6430597f303d0d8cc876ce8a55801a7 (diff)
downloadIshtar-a3648dfd62e28488737866385aa56dadf1df0d69.tar.bz2
Ishtar-a3648dfd62e28488737866385aa56dadf1df0d69.zip
Admin - Geojson update: add an option to update only geom
Diffstat (limited to 'ishtar_common/admin.py')
-rw-r--r--ishtar_common/admin.py8
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