Skip to content

Commit

Permalink
Check in cleaned data no self.data for all values
Browse files Browse the repository at this point in the history
  • Loading branch information
ortsed committed Apr 18, 2012
1 parent a42bac2 commit 72dfccd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cropduster/views.py
Expand Up @@ -55,11 +55,12 @@ class Meta:
"image": TextInput(), "image": TextInput(),
} }
def clean(self): 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() self._errors.clear()
raise ValidationError("Missing crop values") raise ValidationError("Missing crop values")

cleaned_data = super(CropForm, self).clean()


if cleaned_data["crop_x"] < 0 or cleaned_data["crop_y"] < 0: if cleaned_data["crop_x"] < 0 or cleaned_data["crop_y"] < 0:
self._errors.clear() self._errors.clear()
Expand Down

0 comments on commit 72dfccd

Please sign in to comment.