djblets.extensions.views¶
Views for extensions (used in the admin UI).
- extension_list(request: HttpRequest, *, extension_manager: ExtensionManager, template_name: str = 'extensions/admin/extension_list.html', extra_context: Mapping[str, Any] | None = None) HttpResponse[source]¶
A view for listing available extensions.
This will load the list of extensions and render them in the provided template.
It will also handle certain actions, such as forcing a reload of available extensions. The actions are not considered public API, and are internal to the page.
Changed in version 6.0:
Added the
extra_contextargument.All arguments except for
requestmust be included as keyword-only arguments. This will be enforced in Djblets 7.
- Parameters:
request (
django.http.HttpRequest) – The HTTP request from the client.extension_manager (
djblets.extensions.manager.ExtensionManager) – The extension manager managing the extensions shown on the page.template_name (
str, optional) – The name of the template to render.extra_context (
dict, optional) –Extra context to provide for the template.
New in version 6.0.
- Returns:
The HTTP response to send to the client.
- Return type:
- Raises:
django.http.Http404 – The extension does not support configuration.
- configure_extension(request: HttpRequest, *, ext_class: type[Extension], form_class: type[SettingsForm], extension_manager: ExtensionManager, template_name: str = 'extensions/configure_extension.html', extra_context: Mapping[str, Any] | None = None) HttpResponse[source]¶
A view for configuring an extension.
This can be used to provide a configuration page for an extension. The extension can include this in its list of URL patterns, or it can wrap it in another function.
The view will take care of fetching the appropriate extension, check if it’s configurable, render it, and handle results.
Changed in version 6.0:
Added the
extra_contextargument.All arguments except for
requestmust be included as keyword-only arguments. This will be enforced in Djblets 7.
- Parameters:
request (
django.http.HttpRequest) – The HTTP request from the client.ext_class (
type) – The class for the extension.form_class (
type) – The class for the settings form.extension_manager (
djblets.extensions.manager.ExtensionManager) – The extension manager that manages the extension.template_name (
str, optional) – The name of the template to render.extra_context (
dict, optional) –Extra context to provide for the template.
New in version 6.0.
- Returns:
The HTTP response to send to the client.
- Return type:
- Raises:
django.http.Http404 – The extension does not support configuration.