Fix loading some parts of the Django administration UI.
Review Request #11612 — Created May 21, 2021 and submitted
Review Board 4.0 introduced its own
AdminSite
class, 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 (sinceAdminSite
keeps them
around), but it turns out thatadmin.py
discovery would copy and reset
the instance any time anadmin.py
was missing from a module. That
broke our shared instances, meaning that we could only share up to the
first module missing anadmin.py
.We now copy state, rather than attempting to share state, and override
theAdminSite
instance indjango.contrib.admin
. This isn't ideal,
but Django, despite supporting customAdminSite
subclasses, doesn't
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.
Summary | ID |
---|---|
620b1fb47e30bb8ab29dc4ef00b00ff7d89c15c9 |