#28267: Change submit_line implementation to allow easier modification
---------------------------------+--------------------------------------
     Reporter:  Karolis Ryselis  |                    Owner:  nobody
         Type:  New feature      |                   Status:  new
    Component:  contrib.admin    |                  Version:  master
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Unreviewed
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+--------------------------------------

Comment (by Karolis Ryselis):

 I agree that current solution does indeed allow to add a new button to
 submit line. However, I still see some more issues.
 I have done several Django version upgrades on a large Django project.
 Every time problems arise when something is overridden without calling
 `super` - by copy - pasting all code from Django default implementation.
 When Django code is updated, I have to manually make sure that every
 overridden method is intact with latest changes. Current implementation
 adds to the number of possible modifications that need to be checked and
 migration to a new version becomes painful.
 I don't know if proposed solution is the best that can be done. What I
 like about it is that I can avoid the problems I have described; I like
 defining things in Python more than defining them in HTML.

 If you don't like changing everything in the template, there are different
 possible solutions:
 - move wrapping `div` outside of `submit_line.html`. Pros: easy button
 adding before and after default buttons by extending existing template.
 Cons: if inner HTML of default buttons changes and I want my custom
 buttons to match them, I have to change every button; difficult to add a
 button in the middle - still requires overriding whole template; `div`
 must be added in all places where `submit_line.html` is used.
 - wrap existing buttons in a `block` that lives inside the `div`. Pros and
 cons are the same, except for adding `div` everywhere around
 `submit_line.html`

 Despite this I feel like buttons belong to the admin, not the template,
 because admin needs to handle these buttons anyway. As far as current
 implementation, buttons (their names specifically) are defined in the
 template and used in change form view in admin.

 I do not know if proposed solution is the best we can do, but I feel like
 current implementation is not excellent either

--
Ticket URL: <https://code.djangoproject.com/ticket/28267#comment:4>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.fae229e693b18e957e87d0fd1906b6eb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to