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

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

Information

Review Board
release-5.0.x

Reviewers

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.

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

Verifeid that other change forms are unaffected.

Summary ID
Fix a regression in rendering admin pages for non-model change forms.
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.
43cd06410d1d7b4cfe43c0ee7a9c9a37bfb2d1f6
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.0.x (c8b33eb)