summaryrefslogtreecommitdiff
path: root/chimere/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2012-11-16 16:14:11 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2012-11-16 16:14:11 +0100
commit9821fba04d499c5536e1d7877128f01ba7092e9e (patch)
tree15ce97b2370310b72f0372da8099e585933ae1a8 /chimere/forms.py
parent14798fd25b0e8445d66e9d83f562caee044e1907 (diff)
downloadChimère-9821fba04d499c5536e1d7877128f01ba7092e9e.tar.bz2
Chimère-9821fba04d499c5536e1d7877128f01ba7092e9e.zip
Admin: Fix check problems in imports - improve area and property model list (refs #413)
Diffstat (limited to 'chimere/forms.py')
-rw-r--r--chimere/forms.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/chimere/forms.py b/chimere/forms.py
index 4b4d49f..6ab44d3 100644
--- a/chimere/forms.py
+++ b/chimere/forms.py
@@ -110,17 +110,17 @@ class ImporterAdminForm(forms.ModelForm):
Verify that only one type of source is provided
Verify that shapefiles are zipped
'''
- if self.cleaned_data['importer_type'] == 'SHP' and \
- not self.cleaned_data['zipped']:
+ if self.cleaned_data.get('importer_type') == 'SHP' and \
+ not self.cleaned_data.get('zipped'):
raise forms.ValidationError(_(u"Shapefiles must be provided in a "\
u"zipped archive."))
- if self.cleaned_data['source'] and \
- self.cleaned_data['source_file']:
+ if self.cleaned_data.get('source') and \
+ self.cleaned_data.get('source_file'):
raise forms.ValidationError(_(u"You have to set \"source\" or "
u"\"source file\" but not both."))
- if not self.cleaned_data['source'] and \
- not self.cleaned_data['source_file'] and \
- self.cleaned_data['importer_type'] != 'OSM':
+ if not self.cleaned_data.get('source') and \
+ not self.cleaned_data.get('source_file') and \
+ self.cleaned_data.get('importer_type') != 'OSM':
raise forms.ValidationError(_(u"You have to set \"source\" or "
u"\"source file\"."))
return self.cleaned_data