#12525: ModelForm validation doesn't work like documented
-----------------------------------------------------+----------------------
          Reporter:  Bernd Schlapsi <[email protected]>  |         Owner:  nobody   
 
            Status:  reopened                        |     Milestone:  1.2      
 
         Component:  Forms                           |       Version:  SVN      
 
        Resolution:                                  |      Keywords:  
Validators
             Stage:  Unreviewed                      |     Has_patch:  0        
 
        Needs_docs:  0                               |   Needs_tests:  0        
 
Needs_better_patch:  0                               |  
-----------------------------------------------------+----------------------
Changes (by Bernd Schlapsi <[email protected]>):

  * status:  closed => reopened
  * resolution:  worksforme =>

Comment:

 Ok, you're right. I missed something in my example. The problem occurs if
 you add the clean method to the form class
 {{{
 class PersonForm(forms.ModelForm):
     class Meta:
         model = Person

     def clean(self):
         return self.cleaned_data
 }}}

 Then the output is:
 {{{
 {}
 }}}

 But the documentation
 (http://docs.djangoproject.com/en/dev//ref/forms/validation/#cleaning-and-
 validating-fields-that-depend-on-each-other) doesn't mention to call the
 superclass method in my clean method.[[BR]]
 My example only works if the form class looks like:
 {{{
 class PersonForm(forms.ModelForm):
     class Meta:
         model = Person

     def clean(self):
         super(PersonForm, self).clean()
         return self.cleaned_data
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12525#comment:2>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.


Reply via email to