Django: Overriding the clean() method in forms - question about raising errors -


I'm talking in a clear way like this:

  Cleaned_data ['type']. Organized_by! = Self.cleaned_data ['organized_by']: forms.ValidationError ('type and organization do not match.') If self.cleaned_data ['start'] & gt; Self.cleaned_data ['end']: forms.ValidationError ('The start date can not be more than the end date.')  

But then it means that the form only increases one Can one of these errors be formulated to increase these two errors at a time?

Edit # 1 : Any solution above is great, but there will be anything that looks like a scenario:

  Self.cleaned_data ['type'] Organized_by! = Self.cleaned_data ['organized_by']: forms.ValidationError ('type and organization do not match.') If self.cleaned_data ['start'] & gt; Self.cleaned_data ['end']: forms.ValidationError ('Start Date can not be more than the end date.') Super (FooForm, Self). Skin ()  

Where FooAddForm is a model form and there are unique obstacles in it which can also cause errors. If anyone knows something like this, then it would be great ...

From Docs:

: if self.cleaned_data ['type']. Organized_by! = Self.cleaned_data ['organized_by']: Msg = 'Type and organization do not match.' Self._errors ['type'] = error list ([msg]) del self.cleaned_data ['type'] if self.cleaned_data ['start']> Self.cleaned_data ['end']: msg = 'The start date can not be later than the expiration date.' Self._errors ['start'] = error list ([msg]) del self.cleaned_data ['start'] Returns self-linked_data

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -