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