#27660: clean() not called on ModelForm for UpdateView
-------------------------------------+-------------------------------------
               Reporter:  Benjamin   |          Owner:  nobody
  von Deschwanden                    |
                   Type:  Bug        |         Status:  new
              Component:  Forms      |        Version:  1.10
               Severity:  Normal     |       Keywords:  ModelForm,
           Triage Stage:             |  UpdateView, clean()
  Unreviewed                         |      Has patch:  0
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 I am using a ModelForm as the 'form' attribute of an UpdateView.
 Overriding the clean() method of the ModelForm does not work; the method
 does not seem to be called. The undesired behavior can be reconstructed as
 follows:

 - Set up new django project
 - Create view and form:

 {{{
     class RouteUpdate(UpdateView):
         model = Route
         form_class = RouteForm

     class RouteForm(ModelForm):
         class Meta:
             model = Route
             fields = [...]

         def clean(self):
             cleaned_data = super(RouteForm, self).clean()
             print("This method will not be executed...")
             return cleaned_data
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27660>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.5da628a07760e9954aeb115451e4cf92%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to