Fix loading admin pages with Delete links on extension admin sites.

Review Request #12063 — Created Feb. 19, 2022 and submitted

Information

Review Board
release-4.0.x

Reviewers

When rendering the change form for a model on an admin site, we were
using Django's admin_urlname() function to generate the namespaced URL
name to the model.

Since this is what Django itself calls, it was expected to work
regardless of the AdminSite hosting the page. However, in reality, it
just hard-codes admin as the namespace, without caring about the
actual AdminSite.

This change removes this call entirely, switching to our own URL
building logic that respects the AdminSite name.

Tested loading normal database model change forms, and extension-provided
ones.

Tested the Delete button in each case.

Summary ID
Fix loading admin pages with Delete links on extension admin sites.
When rendering the change form for a model on an admin site, we were using Django's `admin_urlname()` function to generate the namespaced URL name to the model. Since this is what Django itself calls, it was expected to work regardless of the `AdminSite` hosting the page. However, in reality, it just hard-codes `admin` as the namespace, without caring about the actual `AdminSite`. This change removes this call entirely, switching to our own URL building logic that respects the `AdminSite` name.
3bc8f9ad61b3af7f607a6284472f18ddef02724b
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (4945c36)