reviewboard.admin.actions¶
Built-in actions for the admins app.
New in version 7.1.
- class BaseAdminSidebarGroupAction[source]¶
Bases:
BaseGroupActionBase class for sidebar group actions.
This allows for additional metadata for template hooks that render at the end of the items for the group.
New in version 7.1.
- class BaseAdminSidebarManageItemAction[source]¶
Bases:
BaseActionBase class for sidebar item actions.
This allows for additional metadata for optional Add Item URLs/titles and item counts.
New in version 7.1.
- admin_site_name: ClassVar[str] = 'admin'¶
The admin site name used for URL resolution.
Extensions should set this to their extension’s main module name containing the admin site.
- item_queryset: ClassVar[QuerySet | None] = None¶
Queryset used to count items in the database.
If not set, a default queryset based on
modelwill be used.
- get_add_item_url() str | None[source]¶
Return the URL to add a new item.
If
add_item_url_nameis set, it will be used as a URL name and resolved. Otherwise, a URL will be derived frommodelusing the default database.Extensions must override to generate a path suitable for their own database.
- Returns:
The Add Item URL, or
Noneif one is not set or can’t be looked up.- Return type:
- get_url(*, context: Context) str[source]¶
Return the URL for the navigation item.
If
urlorurl_nameare not explicitly set, a URL will be generated based onmodel.- Parameters:
context (
django.template.Context) – The current rendering context.- Returns:
The URL to use for the action.
- Return type:
- get_item_count() int | None[source]¶
Return the number of items to show in the sidebar.
This will default to performing a query using
item_queryset, returningNoneif not set.- Returns:
The number of items, or
Noneif it can’t be queried.- Return type:
- get_item_queryset() django.db.models.query.QuerySet | None[source]¶
Return the queryset for the items.
This will default to returning a copy of
item_queryset, if set, or a queryset based onmodel.- Returns:
The queryset used to perform item lookups.
- Return type:
- class AdminSidebarActionGroupRenderer(*, action: BaseAction, placement: ActionPlacement)[source]¶
Bases:
SidebarActionGroupRendererRenderer for admin sidebar groups.
This provides additional CSS for the group based on whether there are icons shown in group items.
It also provides a template hook for post-group rendering, if the action group has a
sidebar_hook_pointattribute.New in version 7.1.
Bases:
BaseAdminSidebarGroupActionAdministration navigation group action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A template hook point to include at the bottom of the items.
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionAdministration -> Dashboard navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionAdministration -> Licenses navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionAdministration -> Security navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionAdministration -> Extensions navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionAdministration -> Integrations navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionAdministration -> Database navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseAdminSidebarGroupActionSettings navigation group action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A template hook point to include at the bottom of the items.
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionSettings -> General navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionSettings -> Authentication navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionSettings -> Avatars navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionSettings -> E-Mail navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionSettings -> Review Workflow navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionSettings -> Diff Viewer navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionSettings -> Logging navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionSettings -> SSH navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionSettings -> File Storage navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionSettings -> User Privacy navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionSettings -> Support navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseActionSettings -> Search navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A URL name to resolve.
If this is not None, it will take precedence over
url.- Type:
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- class AdminSidebarManageActionRenderer(*, action: BaseAction, placement: ActionPlacement)[source]¶
Bases:
SidebarItemActionRendererAdmin sidebar renderer for items in the Manage section.
This renders the sidebar item with an Add Item icon and an item count, if found. Data is pulled from cache, and recomputed if missing from cache.
New in version 7.1.
- template_name: ClassVar[str | None] = 'admin/actions/sidebar_item_action.html'[source]¶
The name of the template to use when rendering.
- get_extra_context(*, request: HttpRequest, context: Context) dict[str, Any][source]¶
Return extra template context for the action.
- Parameters:
request (
django.http.HttpRequest) – The HTTP request from the client.context (
django.template.Context) – The current rendering context.
- Returns:
Extra context to use when rendering the action’s template.
- Return type:
- class AdminSidebarManageActionGroupRenderer(*, action: BaseAction, placement: ActionPlacement)[source]¶
Bases:
AdminSidebarActionGroupRendererAdmin sidebar renderer for the Manage section.
This is a special action group that looks up and caches both the Add Item URLs for each type of action and the number of items currently in the database.
State is cached especially to reduce the number of database queries across page loads. Caches are only valid for 5 minutes, ensuring that manual modifications to the database won’t retain old counts for long.
Cached state is opportunistic. URLs and counts for any given item are fetched by the item renderer as needed if not found in the cache.
New in version 7.1.
- default_item_renderer_cls[source]¶
alias of
AdminSidebarManageActionRenderer
- get_extra_context(*, request: HttpRequest, context: Context) dict[str, Any][source]¶
Return extra template context for the action.
This includes precomputed state for our default actions, containing Add Item URLs and item counts.
- Parameters:
request (
django.http.HttpRequest) – The HTTP request from the client.context (
django.template.Context) – The current rendering context.
- Returns:
Extra context to use when rendering the action’s template.
- Return type:
Bases:
BaseAdminSidebarGroupActionManage navigation group action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
A template hook point to include at the bottom of the items.
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseAdminSidebarManageItemActionManage -> Users navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
alias of
User
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseAdminSidebarManageItemActionManage -> Review Groups navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
alias of
Group
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseAdminSidebarManageItemActionManage -> Default Reviewers navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
alias of
DefaultReviewer
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseAdminSidebarManageItemActionManage -> Repositories navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
alias of
Repository
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseAdminSidebarManageItemActionManage -> WebHooks navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
alias of
WebHookTarget
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseAdminSidebarManageItemActionManage -> Hosting Accounts navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
alias of
HostingServiceAccount
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
Bases:
BaseAdminSidebarManageItemActionManage -> OAuth2 Applications navigation action.
New in version 7.1.
The internal ID of the action.
This must be unique.
- Type:
The user-visible label.
- Type:
alias of
Application
The placements of this action within the page.
Each entry defines a placement within an attachment point and an action parent/child hierarchy where action should be rendered, along with options controlling the rendering.
New in version 7.1.
- get_default_admin_actions() Iterator[BaseAction][source]¶
Return the default actions registered for the admin UI.
This supplies default data for the actions registry. It’s not meant to be called by any other callers.
New in version 7.1.
- Yields:
reviewboard.actions.base.BaseAction– Each action to register.
- get_default_admin_attachment_points() Iterator[ActionAttachmentPoint][source]¶
Return the default attachment points registered for the admin UI.
This supplies default data for the attachment points registry. It’s not meant to be called by any other callers.
New in version 7.1.
- Yields:
reviewboard.actions.base.ActionAttachmentPoint– Each attachment point to register.