djblets.configforms.views¶
Standard views for displaying and interacting with configuration forms.
- class ConfigPagesView(**kwargs)[source]¶
Bases:
TemplateView
Base view for a set of configuration pages.
This will render the page for managing a set of configuration sub-pages (
djblets.configforms.pages.ConfigPage
subclasses).Subclasses are expected to provide
title
andpage_classes
, at a minimum.To dynamically compute pages, implement a
page_classes
method and decorate it with@property
.The title to display over the navigation sidebar.
- base_template_name = 'base.html'[source]¶
The base template that the default template should inherit from.
- post(request, *args, **kwargs)[source]¶
Handle HTTP post requests to the view.
This will instantiate the form that the POST was targeting, validate the form, and then trigger its save if valid, reloading the page with the new state.
- Parameters:
request (
HttpRequest
) – The HTTP request from the client.- Returns:
Either a redirect (if successfully posted), or a standard response with the page content.
- Return type:
HttpResponse
- get_context_data(**kwargs)[source]¶
Return extra context data to render in the template.
- Returns:
A dictionary of context data for the page.
- Return type:
- get_js_view_data()[source]¶
Return custom options to pass to the JavaScript view.
By default, this will return an empty dictionary. Subclasses can override to provide custom data.
- Returns:
A dictionary of options to pass to the View instance. By default, this will be empty.
- Return type:
- get_js_model_data()[source]¶
Return custom attributes to pass to the JavaScript model.
If
js_model_class
is provided, the data returned from this function will be provided to the model when constructued.By default, this will return an empty dictionary. Subclasses can override to provide custom data.
- Returns:
A dictionary of attributes to pass to the Model instance. By default, this will be empty.
- Return type: