本文整理汇总了Python中maker.core.models.ModuleSetting.add_for_module方法的典型用法代码示例。如果您正苦于以下问题:Python ModuleSetting.add_for_module方法的具体用法?Python ModuleSetting.add_for_module怎么用?Python ModuleSetting.add_for_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maker.core.models.ModuleSetting
的用法示例。
在下文中一共展示了ModuleSetting.add_for_module方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: integration_add
# 需要导入模块: from maker.core.models import ModuleSetting [as 别名]
# 或者: from maker.core.models.ModuleSetting import add_for_module [as 别名]
def integration_add(request, resource_id, response_format="html"):
"Integration add new resource page"
user = request.user.get_profile()
conf = ModuleSetting.get("nuvius_profile", user=user)
try:
profile = conf[0].loads()
except IndexError:
profile = None
resource = None
data = None
if profile:
connector = Connector(request, profile_id=profile["id"])
resource = DataBlock(connector.get_app(resource_id))
if request.POST and "add" in request.POST:
resource = IntegrationResource(profile["id"], resource_id, resource.application.name.raw, "9rw")
conf = ModuleSetting.add_for_module("integration_resource", "", "maker.identities", user=user)
conf.dumps(resource).save()
return HttpResponseRedirect(reverse("identities_integration_index"))
else:
data = connector.get(
"/service/contact-book/contact/data.json/id" + profile["id"] + "/app" + unicode(resource_id),
no_cache=True,
)
data = DataBlock(data)
if data.result_name == "success":
pass
elif data.result_name == "redirect":
next = request.build_absolute_uri(reverse("identities_integration_add", args=[resource_id]))
data = connector.get(
"/service/contact-book/contact/data.json/id" + profile["id"] + "/app" + unicode(resource_id),
parameters={"next": next},
no_cache=True,
)
data = DataBlock(data)
context = _get_default_context(request)
context.update({"resource_id": resource_id, "resource": resource, "data": data})
return render_to_response(
"identities/integration_add", context, context_instance=RequestContext(request), response_format=response_format
)