本文整理汇总了Python中models.Task.view方法的典型用法代码示例。如果您正苦于以下问题:Python Task.view方法的具体用法?Python Task.view怎么用?Python Task.view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Task
的用法示例。
在下文中一共展示了Task.view方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: edit_item
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import view [as 别名]
def edit_item(request, item_id, existence=False):
item = WFItem.get(item_id)
if not item:
return HttpResponseNotFound()
wf_name = "%s_editor" % item.item_type
if existence:
wf_name = "%s_editor_existencia" % item.item_type
workflow = WorkFlow.view("couchflow/orig_workflows",
include_docs=True)[wf_name].one()
if not workflow:
return HttpResponseNotFound()
workflow = clone_this_wf(workflow._id, request.user._id)
workflow.nro_pedido = get_nro_pedido()
workflow.visible = False
workflow.set_enabled()
try:
workflow.save()
except ResourceConflict:
pass
task = Task.view("couchflow/activetask",
include_docs=True)[workflow._id].one()
if not existence:
task.wfitems_ids = [item_id]
else:
task.base_item = item_id
task.visible = False
task.save()
return HttpResponseRedirect("/couchflow/execute_task/%s/" % task._id)
示例2: get_nro_pedido
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import view [as 别名]
def get_nro_pedido():
nro_pedido = Task.view('couchflow/max_pedido', limit=1, descending=True)
nro_pedido = nro_pedido.one()
if not nro_pedido:
nro_pedido = 41
else:
nro_pedido = int(nro_pedido['key'])
nro_pedido += 1
return nro_pedido
示例3: exec_url
# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import view [as 别名]
def exec_url(request, url_name):
workflow = WorkFlow.view("couchflow/orig_workflows",
include_docs=True)[url_name].one()
if not workflow:
return HttpResponseNotFound()
workflow = clone_this_wf(workflow._id, request.user._id)
workflow.nro_pedido = get_nro_pedido()
workflow.set_enabled()
try:
workflow.save()
except ResourceConflict:
pass
task = Task.view("couchflow/activetask",
include_docs=True)[workflow._id].one()
return HttpResponseRedirect("/couchflow/execute_task/%s/" % task._id)