Re: Forms: custom clean for DateField

2009-03-19 Thread johan . uhle
> if (data['firstDate'] >= data['lastDate']): > raise ValidationError("Error") it should read raise forms.ValidationError If you want to have the error not only as a non_field global error, but actually added to the fields where the error occured, you can do the following in

Re: Forms: custom clean for DateField

2009-03-18 Thread Wim Feijen
Hi Marco, In Django 1.0, you don't need to call clean from clean, Django will do that automatically for you. :) So what you can do is: def clean(self): data = self.cleaned_data if (data['firstDate'] >= data['lastDate']): raise ValidationError("Error")

Re: Forms: custom clean for DateField

2009-03-06 Thread MarcoS
Sorry, i've posted without finishing the message :) So, if I call clean(self), Django give me this exception for the following line: super(forms.DateField, self).clean() Exception Type: TypeError Exception Value: super(type, obj): obj must be an instance or subtype of type