summaryrefslogtreecommitdiff
path: root/chimere/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2012-11-14 19:40:16 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2012-11-14 19:40:16 +0100
commit53626da019d22a6b7eeadbedad983ba187b2f54c (patch)
tree09b77ad78b580cc8309b419ef8a62ea6562bb588 /chimere/forms.py
parentb8ba0c6cb2ed1a8a05f72cf60110cccb9cab16ce (diff)
downloadChimère-53626da019d22a6b7eeadbedad983ba187b2f54c.tar.bz2
Chimère-53626da019d22a6b7eeadbedad983ba187b2f54c.zip
Forms: don't allow empty area and smae order number (refs #414)
Diffstat (limited to 'chimere/forms.py')
-rw-r--r--chimere/forms.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/chimere/forms.py b/chimere/forms.py
index fea99b1..5761e2b 100644
--- a/chimere/forms.py
+++ b/chimere/forms.py
@@ -454,6 +454,17 @@ class AreaAdminForm(forms.ModelForm):
keys['initial'] = dct
super(AreaAdminForm, self).__init__(*args, **keys)
+ def clean(self):
+ '''
+ Verify that the area is not empty
+ '''
+ if not self.cleaned_data.get('upper_left_lat') \
+ and not self.cleaned_data.get('upper_left_lon') \
+ and not self.cleaned_data.get('lower_right_lat') \
+ and not self.cleaned_data.get('lower_right_lon'):
+ msg = _(u"No area selected.")
+ raise forms.ValidationError(msg)
+
def save(self, *args, **keys):
"""
Custom save method in order to manage area