Fix the defaults around the Save buttons in Settings/Model Change forms.
Review Request #11344 — Created Dec. 23, 2020 and submitted
The new template for the change forms tried to use defaults if variables
for controlling the presence of the Save buttons weren't provided.
However, it did this using|default:True
, which meant that a value of
False
would be turned intoTrue
. Not what we wanted.That, however, was put in place (in change 663f50d) in order to fix a
prior (incorrect) attempt that used|default_if_none
. That could have
worked if that filter considered a missing variable to be equivalent to
None
, but it didn't.Even with these attempts, we had two code paths for generating that
template: Ours, and Django's, depending on whether a change form was
being rendered.This change implements a more future-proof, reliable attempt at
generating these buttons. We now have a dedicated template tag that
covers the logic in Django's ownsubmit_row
template tag and our own
logic, and expands upon that to allow greater customization by callers
(a Delete button is now possible without the rest of the admin classes).With this, the Settings forms and Model Change forms all now show the
correct buttons.
Tested all the Settings forms, various model change forms, and the
integrations/extensions forms (which use their own templates anyway).
- Change Summary:
-
Fixed an alignment issue.
- Commits:
-
Summary ID fe49bdb841d7930aa354e51c451c77b479fa2dd9 12b3a6647ce8c88ad56485138bbb9bc2b91f015b