Fix loading some parts of the Django administration UI.
Review Request #11612 — Created May 21, 2021 and submitted — Latest diff uploaded
Review Board 4.0 introduced its own
AdminSiteclass, which attempted
to mirror the main one. This mostly worked, but some apps (namely in our
case, Django Evolution) didn't make it into our mirror.
This is because we were actually sharing instances of the dictionaries,
expecting that they wouldn't be replaced (since
around), but it turns out that
admin.pydiscovery would copy and reset
the instance any time an
admin.pywas missing from a module. That
broke our shared instances, meaning that we could only share up to the
first module missing an
We now copy state, rather than attempting to share state, and override
django.contrib.admin. This isn't ideal,
but Django, despite supporting custom
offer an alternative (at least in 1.11). This is the approach other
projects appear to have settled on.
Tested loading all parts of the admin UI (list and change forms),
without encountering any crashes.