From 7d8c3719bb2dfaa70b1d6c5e2a19c53588091d3b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 19 Nov 2012 00:59:27 +0100 Subject: Admin: Fix "order" check for areas --- chimere/forms.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chimere/forms.py b/chimere/forms.py index 4c26d52..6a7d7aa 100644 --- a/chimere/forms.py +++ b/chimere/forms.py @@ -476,6 +476,12 @@ class AreaAdminForm(forms.ModelForm): and not self.cleaned_data.get('area'): msg = _(u"No area selected.") raise forms.ValidationError(msg) + if self.cleaned_data.get('order'): + q = Area.objects.filter(order=self.cleaned_data.get('order')) + if q.count(): + msg= _(u"The area \"%s\" has the same order, you need to " + u" choose another one.") % unicode(q.all()[0]) + raise forms.ValidationError(msg) return self.cleaned_data def save(self, *args, **keys): -- cgit v1.2.3