When startdate is cleaned and invalid it's removed from cleaned_data, so
we cannot test it in clean_enddate.
if self.instance.pk and self.instance.approved:
if self.cleaned_data['enddate'] != self.instance.enddate:
raise ValidationError("You cannot change the dates on events that have been approved")
- if self.cleaned_data['enddate'] < self.cleaned_data['startdate']:
+ if self.cleaned_data.has_key('startdate') and self.cleaned_data['enddate'] < self.cleaned_data['startdate']:
raise ValidationError("End date cannot be before start date!")
return self.cleaned_data['enddate']