Jump to >

This documentation covers the in-development release of Djblets. You can see the latest stable docs or all previous versions.

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:
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:

object

set_key_value(key, value)[source]

Set the value for a SiteConfiguration settings key.

Parameters:
  • key (unicode) – The settings key.
  • value (object) – The settings value.
save_instance()[source]

Save the SiteConfiguration instance.

declared_fields = {}[source]