djblets.configforms.pages¶
Base support for configuration pages.
- class ConfigPage(config_view, request, user)¶
Bases:
object
Base class for a page of configuration forms.
Each ConfigPage is represented in the main page by an entry in the navigation sidebar. When the user has navigated to that page, all visible
djblets.configforms.forms.ConfigPageForm
subclasses owned by the ConfigPage will be displayed.- page_id: Optional[str] = None¶
The unique ID of the page.
This must be unique across all ConfigPages at a given URL.
- page_title: Optional[Union[str, StrPromise]] = None¶
The displayed title for the page.
This will show up in the navigation sidebar.
- form_classes: Optional[List[Type[ConfigPageForm]]] = None¶
The list of form subclasses to display on the page.
- template_name = 'configforms/config_page.html'¶
The template used to render the page.
- __init__(config_view, request, user)¶
Initialize the page.
- Parameters:
config_view (
ConfigPagesView
) – The view that manages this ConfigPage.request (
HttpRequest
) – The HTTP request from the client.user (
User
) – The user who is viewing the page.
- is_visible()¶
Return whether the page should be visible.
Visible pages are shown in the sidebar and can be navigated to.
By default, a page is visible if at least one of its forms are also visible.
- Returns:
True
if the page will be rendered, orFalse
otherwise.- Return type:
- render()¶
Render the page to a string.
template_name
will be used to render the page. The template will be passedpage
(this page’s instance) andforms
(the list ofConfigPageForm
instances to render).Subclasses can override this to provide additional rendering logic.
- Returns:
The rendered page as HTML.
- Return type:
- __annotations__ = {'form_classes': 'Optional[List[Type[ConfigPageForm]]]', 'page_id': 'Optional[str]', 'page_title': 'Optional[StrOrPromise]'}¶