djblets.siteconfig.models¶
-
class
SiteConfigSettingsWrapper
(siteconfig)[source]¶ Bases:
object
Wraps the settings for a SiteConfiguration.
This is used by the context processor for templates to wrap accessing settings data, properly returning defaults.
-
class
SiteConfiguration
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Configuration data for a site. The version and all persistent settings are stored here.
The usual way to retrieve a SiteConfiguration is to use
get_current()
.-
get
(key, default=None)[source]¶ Retrieves a setting. If the setting is not found, the default value will be returned. This is represented by the default parameter, if passed in, or a global default if set.
-
set
(key, value)[source]¶ Sets a setting. The key should be a string, but the value can be any native Python object.
-
add_defaults
(defaults_dict)[source]¶ Add a dictionary of defaults.
These defaults will be used when calling
get()
, if that setting wasn’t saved in the database.
-