• 
      

    Import and reload all admin modules for an extension's apps.

    Review Request #14798 — Created Feb. 4, 2026 and submitted

    Information

    Djblets
    release-5.x

    Reviewers

    When loading or reloading an extension, the main extension module's
    .admin submodule was being imported or reloaded. If the extension had
    apps with their own .admin, those would never be reloaded, even though
    Django itself would initially import them. This would cause admin site
    registrations to disappear on extension reload, since the AdminSite
    would be thrown away and the new one would never be set up.

    We now properly handle an import/reload for each extension app's
    .admin submodule.

    Note that if an extension was trying to import one .admin from another
    to work around this, they might get duplicate registration errors that
    prevent the extension from loading. However, these extensions would have
    had problems during reload anyway.

    Unit tests passed.

    Triggered frequent extension state reloading and verified an issue I hit
    with Power Pack's admin registrations went away, and that the appropriate
    modules were reloading.

    Summary ID
    Import and reload all admin modules for an extension's apps.
    When loading or reloading an extension, the main extension module's `.admin` submodule was being imported or reloaded. If the extension had apps with their own `.admin`, those would never be reloaded, even though Django itself would initially import them. This would cause admin site registrations to disappear on extension reload, since the `AdminSite` would be thrown away and the new one would never be set up. We now properly handle an import/reload for each extension app's `.admin` submodule. Note that if an extension was trying to import one `.admin` from another to work around this, they might get duplicate registration errors that prevent the extension from loading. However, these extensions would have had problems during reload anyway.
    e741f98992f491642730d60c575aea3b438a4911
    david
    1. Ship It!
    2. 
        
    maubin
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-5.x (6d67ff8)