Fix a regression in rendering admin pages for non-model change forms.

Review Request #38 — Created July 28, 2022 and submitted — Latest diff uploaded

guest8249
Review Board
c8b33eb...
dfad
We still utilize a few things in the Django admin UI template and
template tag library for our administration UI. In the upgrade from
Django 1.11 to 3.2, we ended up regressing the ability for extensions to
provide their own change forms.

This was caused by the use of `{% prepopulated_fields_js %}`, which now
explicitly depends on the `opts` variable (equivalent to a
`Model._meta`).

We now only call this if we know we have `opts`. This shouldn't be a
problem for any extensions, as this is really just supporting a
Django-specific feature.

To avoid other issues, all uses of `opts` have now been wrapped in an
`if` check.

Testing Done:
Verified that the Review Bot configuration form can once again be used
in Review Board 5.

Verifeid that other change forms are unaffected.

Reviewed at https://reviews.reviewboard.org/r/12386/

Did all the testing

Loading...