26 lines
593 B
Python
26 lines
593 B
Python
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
from djconfig import config
|
||
|
|
||
|
|
||
|
class KFetConfig(object):
|
||
|
"""kfet app configuration.
|
||
|
|
||
|
Enhance dependency with backend used to store config.
|
||
|
Usable after DjConfig middleware was called.
|
||
|
|
||
|
"""
|
||
|
prefix = 'kfet_'
|
||
|
|
||
|
def __getattr__(self, key):
|
||
|
dj_key = '{}{}'.format(self.prefix, key)
|
||
|
return getattr(config, dj_key)
|
||
|
|
||
|
def list(self):
|
||
|
from kfet.forms import KFetConfigForm
|
||
|
return [(field.label, getattr(config, name), )
|
||
|
for name, field in KFetConfigForm.base_fields.items()]
|
||
|
|
||
|
|
||
|
kfet_config = KFetConfig()
|