Convert the Admin UI sidebar to use the action framework.
Review Request #14721 — Created Dec. 2, 2025 and updated
The admin sidebar used to be composed based off of an HTML file
populated using state from a template tag, with template hooks to append
custom HTML to the sections. While there was some degree of
extensibility, it was a bit limited, requiring the consumer to generate
just the right HTML.This change converts the sidebar to use actions instead. There's now an
action group per group in the sidebar, and an action per child.
Specialized sidebar action renderers take care of rendering with
existing support for the template hook points.The Manage section has the most specializations. The group renderer
takes care of looking up the counts and Add Item URLs for each child
action, caching the results for quicker lookup. The item renderer then
provides this to a template, based on the cached state (falling back to
direct querying if not in the cache).With this, extensions can now simply register actions in the Admin UI
sidebar, taking advantage of the built-in rendering and capabilities.
Tested all the links in the admin UI.
Tested fallback Manage item logic when the cache results come up empty.
| Summary | ID |
|---|---|
| 62600e33436f83cf6d95a0e6fb95ce44f4a28a0c |
| Description | From | Last Updated |
|---|---|---|
|
Can we add tests for some of the new behavior? get_default_admin_actions() get_default_admin_attachment_points() Item counts/urls. |
|
|
|
Shouldn't this inherit from BaseAdminSidebarGroupAction |
|
|
|
Shouldn't this inherit from BaseAdminSidebarGroupAction |
|
|
|
This is no longer setting an expiration on the cache, which means it's not 5 minutes, it's 1 month. |
|
|
|
This ends up creating the queryset object when the class is defined, which seems like it might create confusing bugs … |
|
|
|
It looks like this method is unused now. Can it go away? |
|
|
|
This should be typed to return Iterator[ActionAttachmentPoint] |
|
|
|
Typo: actinos -> actions |
|
|
|
This is making an assumption that sidebar_hook_point is non-None, and it seems like that's the case for the existing groups … |
|
|
|
Shouldn't we type all of the class variables in this class and in BaseAdminSidebarManageItemAction with ClassVar? |
|
|
|
This and the rest of the private methods below need a version added. |
|
|
|
This is missing from the Args docs. |
|
|
|
This is missing from the Args docs. |
|
-
-
Can we add tests for some of the new behavior?
get_default_admin_actions()get_default_admin_attachment_points()- Item counts/urls.
-
-
-
This ends up creating the queryset object when the class is defined, which seems like it might create confusing bugs (especially in the case of running tests). I feel like this would be much better done as a property that can be reimplemented in subclasses and return a new QuerySet when needed.
-
- Change Summary:
-
- Manage action items can now define a
model, with titles/URLs/querysets derived from that. - Caches are now longer and invalidated only when managed models are added/deleted.
- Fixed the parent class for the sidebar group actions.
- Renamed
count_querysettoitem_queryset. - Added
get_item_queryset(), which returns a local instance instead of a shared copy. - Added exception handling around URL resolution, so a bad URL name doesn't break half the sidebar.
- Added back an import to
rbadmintags. - FixAddeded typing on
get_default_admin_actions()andget_default_admin_attachment_points(). - Added unit tests.
- Manage action items can now define a
- Commits:
-
Summary ID 61244c3196e612e5e86f2e9ea69d602810c30082 737a59ec0d0b9d1ba080d24d469a507099d90a91 - Diff:
-
Revision 2 (+3860 -306)
Checks run (2 succeeded)
- Change Summary:
-
- Removed an unused function.
- Fixed a typo in a docstring.
- Template hook points are now only set if
sidebar_hook_pointis set.
- Commits:
-
Summary ID 737a59ec0d0b9d1ba080d24d469a507099d90a91 4c8194b52bf409425db2410878eb8999e48dc85d - Diff:
-
Revision 3 (+3864 -306)
Checks run (2 succeeded)
- Change Summary:
-
Let's try that again.
- Commits:
-
Summary ID 4c8194b52bf409425db2410878eb8999e48dc85d 00705d84da119ed1bee4d5d94f4e0b3c5301f938 - Diff:
-
Revision 4 (+3826 -306)
Checks run (2 succeeded)
- Change Summary:
-
Fixed an outdated comment about the cache time for item counts.
- Commits:
-
Summary ID 00705d84da119ed1bee4d5d94f4e0b3c5301f938 252e3ded9ef0df4fc012e3ebb6a50570f8e22957 - Diff:
-
Revision 5 (+3828 -306)
Checks run (2 succeeded)
- Change Summary:
-
- Added
ClassVarto types. - Added missing
Version Addeddocs. - Added missing
senderarg docs.
- Added
- Commits:
-
Summary ID 252e3ded9ef0df4fc012e3ebb6a50570f8e22957 62600e33436f83cf6d95a0e6fb95ce44f4a28a0c - Diff:
-
Revision 6 (+3870 -306)