#32348: Deleting "extra" inlines in admin should not be possible.
-------------------------------------+-------------------------------------
     Reporter:  Guan                 |                    Owner:  Hasan
                                     |  Ramezani
         Type:  Bug                  |                   Status:  assigned
    Component:  contrib.admin        |                  Version:  3.1
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Guan):

 Replying to [comment:7 Hasan Ramezani]:
 > Now it is ready for review. I am not sure about the logic in
 `toggleDeleteButtonVisibility` function

 Hi! Thanks for your work. But there are probably two slight flaws I think:
  1. When ValidationError is raised, it's no 'X' at the top right of form.
 That the UX is not comfortable is ticket #29087 talked about.
  2. For {{{toggleDeleteButtonVisibility}}} function,  my option comes from
 [https://docs.djangoproject.com/en/3.1/intro/tutorial07/ **extra** form
 could not be removed] and
 [https://docs.djangoproject.com/en/3.1/topics/forms/formsets/ if a formset
 contains no data, then extra + min_num empty forms will be displayed]. So
 the calculation I think is:
 {{{
 const isFormOverload = function() {
     const totalFormNum = ~~totalForms.val();
     const initialFormNum = ~~initialForms.val();
     const minFormNum = ~~minForms.val();
     const extraFormNum = ~~extraForms.val();

     const emptyFormNum = totalFormNum - initialFormNum;
     if (initialFormNum >= emptyFormNum) {
         return emptyFormNum > extraFormNum;
     }
     return emptyFormNum > extraFormNum + minFormNum - initialFormNum;
 }
 }}}

 When {{{isFormOverload}}} returns true, all forms show 'X'.

 I created patch [https://github.com/hramezani/django/pull/1 PR] and I'd
 like to know your option.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32348#comment:8>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.987f4a15d869139f59b453789bd269a7%40djangoproject.com.

Reply via email to