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

Review Request #12386 — Created June 17, 2022 and submitted — Latest diff uploaded


Review Board


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

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.

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

Verifeid that other change forms are unaffected.