Per app constance settings
Project description
##Constance register - constance for third-party packages
Features:
- Easily add settings to global constance config from third-party packages or project applications
How to use it
Install constance and constance register
>>> pip install django-constance django-constance-register
Add constance to INSTALLED_APPS
INSTALLED_APPS = (
...
'constance',
'constance.backends.database',
'constance_register',
...
At the end of settings file add
from constance_register.conf import conf
# Path to your files with configs.
# NOTE: Files are loaded before apps are ready
CONSTANCE_REGISTRY = [
'library.apps.shelf.config',
'library.apps.staff.config'
]
# Load settings
conf.load()
# Add third-party settings to global settings
CONSTANCE_CONFIG = {
'THE_ANSWER': (42, 'Answer to the Ultimate Question of Life, '
'The Universe, and Everything'),
**conf.settings()
}
# Same with fieldsets
CONSTANCE_CONFIG_FIELDSETS = {
**conf.fieldsets()
}
Config file example.
# library.apps.staff.config.py
from datetime import date
app_name = 'staff'
CONFIG = {
'DATE_ESTABLISHED': (date(1972, 11, 30), "the shop's first opening"),
'MY_SELECT_KEY': ('yes', 'select yes or no', 'yes_no_null_select'),
'MULTILINE': ('Line one\nLine two', 'multiline string'),
}
FIELDSET = {
'General Options': {
'fields': ('DATE_ESTABLISHED', 'MY_SELECT_KEY'),
'collapse': True
},
'Theme Options': ('MULTILINE',),
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-constance-register-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4a167ef02cebc631a36c121e0ac4aa2e073aefebaca2c4e42e5894ec3e1e73a |
|
MD5 | 454c3e37ba17cbb20377a2580aeaca96 |
|
BLAKE2b-256 | ff483ca2d81486c603f16701bde20fd7c0a2180904fa2287312bcebfba08316f |
Close
Hashes for django_constance_register-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b049a747a4f014c7be19b1e60b1c27514b1b3ff093b99b0db128fc43f55761bf |
|
MD5 | 2b380a1ce8f186eae2363b81bcc9fa51 |
|
BLAKE2b-256 | ade5d8dab32105b55e74c57e6177c1e48574cdd8c3ed099e147c466dc162d67f |