djblets.siteconfig.forms¶
A base form for working with settings stored on SiteConfigurations.
-
class
SiteSettingsForm
(siteconfig, *args, **kwargs)[source]¶ Bases:
djblets.forms.forms.key_value_form.KeyValueForm
A base form for loading/saving settings for a SiteConfiguration.
This is meant to be subclassed for different settings pages. Any fields defined by the form will be loaded/saved automatically.
-
request
¶ The HTTP request used for this form.
Type: django.http.HttpRequest
-
siteconfig
¶ The site configuration settings are loaded from and saved to.
Type: djblets.siteconfig.models.SiteConfiguration
-
__init__
(siteconfig, *args, **kwargs)[source]¶ Initialize the form.
Parameters: - siteconfig (djblets.siteconfig.models.SiteConfiguration) – The site configuration to work with on the form.
- *args (tuple) – Positional arguments to pass to the parent constructor.
- **kwargs (dict) – Keyword arguments to pass to the parent constructor.
-
get_key_value
(key, default=None)[source]¶ Return the value for a SiteConfiguration settings key.
Parameters: - key (unicode) – The settings key.
- default (object) – The default value from the form, which will be ignored, so that the registered siteconfig defaults will be used.
Returns: The resulting value from the settings.
Return type:
-