Fix some compatibility and structure problems with admin templates.

Review Request #10956 — Created March 13, 2020 and submitted

Review Board

The new revised administration UI templates left out some crucial blocks
that were necessary for some extensions to work, and broke the ability
to override the form submission buttons.

This was largely due to an attempt to simplify the templates, removing
some Djangoisms that didn't appear to make sense, and to also utilize
some other Djangoisms for calculating state needed for form buttons.
What we had just wasn't comprehensive enough.

What we're doing now is bringing back some of the blocks, fixing up some
bad assumptions with the buttons (and allowing them to be better
overridden), and also fixing some incorrect usage of some CSS components.

There's also fixes to the form that previously caused dependencies on an
adminform variable. Most of these are fixed in this change, with a fix
to media coming in a follow-up change.

There's room for improvement here, particularly when it comes to the
form buttons. Eventually we'll want to move away from Django's
{% submit_row %} template tag (which breaks if not working with
models), but that's a task for another day.

Tested the model change pages, settings pages, and the Power Pack
configuration page (which was broken before). They all now render as

Fix some compatibility and structure problems with admin templates.
  1. Ship It!
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (8190e6c)