#11905: modelform_factory returns a broken form when given wrong value for 
fields
-------------------------------+--------------------------------------------
          Reporter:  ben       |         Owner:  copelco                        
     
            Status:  new       |     Milestone:  1.3                            
     
         Component:  Forms     |       Version:  1.1                            
     
        Resolution:            |      Keywords:  modelform_factory, modelform, 
fields
             Stage:  Accepted  |     Has_patch:  1                              
     
        Needs_docs:  0         |   Needs_tests:  0                              
     
Needs_better_patch:  0         |  
-------------------------------+--------------------------------------------
Changes (by copelco):

  * has_patch:  0 => 1

Comment:

 After talking with Karen, I decided to look for a different spot to
 validate the field list. I ended up modifying ModelFormMetaclass to cross
 check the fields generated from fields_for_model() against the form's
 declared fields. fields_for_model returns a mapping of field_name->field,
 but field will be None if field_name is not found on the specified model.
 If the missing field name is not found in the declared field list, then
 the field is considered invalid and will raise a FieldError. With this
 change, the exception is raised when creating the factory, rather than
 when rending the form. Patch with tests is attached.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11905#comment:9>
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