How to override clean method of a form generated by UpdateView?
<p>Is it possible to override a <code>clean method</code> of the form which is generated by <strong>Class Based View</strong> - <code>UpdateView</code>?</p>

<p>In <code>form</code>, I would override <code>clean</code> method to check, whether either first or second field is filled. </p>

<p>Form would be like:</p>

<pre><code>class MyForm(forms.ModelForm):
    ...
    def clean(self):
        super(MyForm,self).clean()
        if bool(self.cleaned_data['first_field'])== bool(self.cleaned_data['first_field']):
            raise ValidationError("Please, fill the first or second field")
</code></pre>

<p>View:</p>

<pre><code>class EditOrderView(UpdateView):
    model = Job
    fields = ['language_from', 'language_to', 'level', 'short_description', 'notes',
              'first_field', 'second_field']
    template_name = 'auth/jobs/update-order.html'

    def get_object(self, queryset=None):
        return get_object_or_404(self.model, pk=self.kwargs["pk"], customer=self.request.user)

    def get_success_url(self):
        return '/my-orders/'

    def form_valid(self, form):
        self.order = form.save()
        email.AdminNotifications.edited_order(self.order)
        return HttpResponseRedirect(self.get_success_url())
</code></pre>