From 72dfccd767c0b99b232712b99cd3c7d534eb9917 Mon Sep 17 00:00:00 2001 From: Llewellyn Hinkes-Jones Date: Wed, 18 Apr 2012 17:34:36 -0400 Subject: [PATCH] Check in cleaned data no self.data for all values --- cropduster/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cropduster/views.py b/cropduster/views.py index ff68c9d5..5af7d8ee 100644 --- a/cropduster/views.py +++ b/cropduster/views.py @@ -55,11 +55,12 @@ class Meta: "image": TextInput(), } def clean(self): - if "crop_x" not in self.data or "crop_y" not in self.data: + + cleaned_data = super(CropForm, self).clean() + + if "crop_x" not in cleaned_data or "crop_y" not in cleaned_data: self._errors.clear() raise ValidationError("Missing crop values") - - cleaned_data = super(CropForm, self).clean() if cleaned_data["crop_x"] < 0 or cleaned_data["crop_y"] < 0: self._errors.clear()