Jump to >

djblets.configforms.pages

Base support for configuration pages.

class ConfigPage(config_view, request, user)[source]

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 = None[source]

The unique ID of the page.

This must be unique across all ConfigPages at a given URL.

page_title = None[source]

The displayed title for the page.

This will show up in the navigation sidebar.

form_classes = None[source]

The list of form subclasses to display on the page.

template_name = u'configforms/config_page.html'[source]

The template used to render the page.

__init__(config_view, request, user)[source]

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()[source]

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, or False otherwise.
Return type:bool
render()[source]

Render the page to a string.

template_name will be used to render the page. The template will be passed page (this page’s instance) and forms (the list of ConfigPageForm instances to render).

Subclasses can override this to provide additional rendering logic.

Returns:The rendered page as HTML.
Return type:unicode