Пример #1
0
def teardown_module(module):
    # settings_registry will be persistent states unless we explicitly clean them up.
    settings_registry.unregister('NAMED_URL_FORMATS')
    settings_registry.unregister('NAMED_URL_GRAPH_NODES')
Пример #2
0
    # the plain JSON format stored in the DB and used in the API.
    default=_get_read_only_ansible_cow_selection_default,
    label=_('Example Read-Only Setting'),
    help_text=_('Example setting that cannot be changed.'),
    category=_('Cows'),
    category_slug='cows',
    # Optional; list of other settings this read-only setting depends on. When
    # the other settings change, the cached value for this setting will be
    # cleared to require it to be recomputed.
    depends_on=['ANSIBLE_COW_SELECTION'],
    # Optional; field is stored encrypted in the database and only $encrypted$
    # is returned via the API.
    encrypted=True,
)

register(
    'EXAMPLE_USER_SETTING',
    field_class=fields.CharField,
    allow_blank=True,
    label=_('Example Setting'),
    help_text=_('Example setting which can be different for each user.'),
    category=_('User'),
    category_slug='user',
    default='',
)

# Unregister the example settings above.
settings_registry.unregister('ANSIBLE_COW_SELECTION')
settings_registry.unregister('READONLY_ANSIBLE_COW_SELECTION')
settings_registry.unregister('EXAMPLE_USER_SETTING')