本文整理汇总了Python中maker.core.models.ModuleSetting.set_for_module方法的典型用法代码示例。如果您正苦于以下问题:Python ModuleSetting.set_for_module方法的具体用法?Python ModuleSetting.set_for_module怎么用?Python ModuleSetting.set_for_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maker.core.models.ModuleSetting
的用法示例。
在下文中一共展示了ModuleSetting.set_for_module方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from maker.core.models import ModuleSetting [as 别名]
# 或者: from maker.core.models.ModuleSetting import set_for_module [as 别名]
def save(self):
"Form processor"
try:
ModuleSetting.set_for_module('default_perspective',
self.cleaned_data['default_perspective'].id,
'maker.core')
ModuleSetting.set_for_module('default_permissions',
self.cleaned_data['default_permissions'],
'maker.core')
ModuleSetting.set_for_module('default_timezone',
self.cleaned_data['default_timezone'],
'maker.core')
ModuleSetting.set_for_module('language',
self.cleaned_data['language'],
'maker.core')
if getattr(settings, 'MAKER_SUBSCRIPTION_CUSTOMIZATION', True):
if isinstance(self.fields['logo'], forms.FileField):
logopath = self._handle_uploaded_file('logo')
ModuleSetting.set_for_module('logopath', logopath, 'maker.core')
elif isinstance(self.fields['logo'], forms.ChoiceField):
if self.cleaned_data['logo'] == 'delete':
try:
ModuleSetting.get_for_module('maker.core', 'logopath').delete()
except:
pass
return True
except:
return False
示例2: save
# 需要导入模块: from maker.core.models import ModuleSetting [as 别名]
# 或者: from maker.core.models.ModuleSetting import set_for_module [as 别名]
def save(self):
"Form processor"
try:
ModuleSetting.set_for_module('default_item_status',
self.cleaned_data['default_item_status'].id,
'maker.infrastructure')
except Exception:
return False