django-simplecms/cms/utils.py

11 wiersze
326 B
Python
Czysty Zwykły widok Historia

2019-03-27 15:49:14 +00:00
from .models import Config
def get_config(parameter):
'''Gets or creates the requested parameter.
'''
if parameter not in [t[0] for t in Config.TYPES]:
raise ValueError('Invalid configuration parameter requested')
(c, created) = Config.objects.get_or_create(parameter=parameter)
return c.content