summaryrefslogtreecommitdiff
path: root/chimere/forms.py
diff options
context:
space:
mode:
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