Jump to >

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.

__init__(siteconfig)[source]
__getattr__(key)[source]
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().

__init__(*args, **kwargs)[source]
site[source]
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.

add_default(key, default_value)[source]

Adds a single default setting.

get_defaults()[source]

Returns all default settings registered with this SiteConfiguration.

is_expired()[source]

Returns whether or not this SiteConfiguration is expired and needs to be reloaded.

save(clear_caches=True, **kwargs)[source]
__str__()[source]
__unicode__()[source]
get_settings_json(model_instance)[source]
set_settings_json(model_instance, json)[source]