#14420: Can't do validation on ModelFormSets to prevent deletion when there is 
only
one object in formset and it is to be deleted
---------------------------------+------------------------------------------
          Reporter:  rory        |         Owner:  nobody                       
  
            Status:  closed      |     Milestone:                               
  
         Component:  Forms       |       Version:  1.1                          
  
        Resolution:  wontfix     |      Keywords:  
validation,formset,modelformset
             Stage:  Unreviewed  |     Has_patch:  0                            
  
        Needs_docs:  0           |   Needs_tests:  0                            
  
Needs_better_patch:  0           |  
---------------------------------+------------------------------------------
Changes (by russellm):

  * status:  new => closed
  * needs_better_patch:  => 0
  * resolution:  => wontfix
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 I'm not convinced this is a bug, since it depends on using validation
 errors to prevent deletion. You point at a specific bug in the 'one
 object' case, but if I understand the code correctly, the same bug will
 exist if you mark every row for deletion, since as you note, you don't
 need to make an object valid in order to delete it, and if there's nothing
 to validate, clean() won't get called on the formset. In order to fix the
 behavior you describe, we would need to change this fundamental assertion
 about when validation will be performed.

 It seems to me like this should be handled by controlling the can_delete
 attribute of sub_forms, rather than trying to evaluate deletion properties
 at the formset level.

 If you feel strongly about this, feel free to start a discussion on
 django-developers and make your case.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14420#comment:1>
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 django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to