djblets.configforms.mixins¶
Utility mixins for configuration forms.
- class DynamicConfigPageMixin¶
Bases:
object
A mixin for utilizing a registry to keep track of the pages and forms.
Objects using this mixin can have a dynamic list of forms, which can be updated by callers. New forms can be registered on them and existing forms can be removed. With this mixin, it is possible to extend a configuration page, allowing each form to load, validate, and save without the page hard-coding support for each form.
Forms utilizing this mixin are required to set the
registry
attribute to an instance ofConfigPageRegistry
.To manage the forms on a page, the
add_form()
andremove_form()
methods should be used.- registry = None¶
- classmethod add_form(form_class)¶
Add a form to the page.
- Parameters:
form_class (
type
) – The form to add to the page, as a subclass ofConfigPage
.
- classmethod remove_form(form_class)¶
Remove a form from the page.
- Parameters:
form_class (
type
) – The form to remove from the page, as a subclass ofConfigPageForm
.