本文整理匯總了Python中workflow.workflow.Workflow.reApplyWorkflow方法的典型用法代碼示例。如果您正苦於以下問題:Python Workflow.reApplyWorkflow方法的具體用法?Python Workflow.reApplyWorkflow怎麽用?Python Workflow.reApplyWorkflow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類workflow.workflow.Workflow
的用法示例。
在下文中一共展示了Workflow.reApplyWorkflow方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: post
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reApplyWorkflow [as 別名]
def post(self, request, *args, **kwargs):
payment_id = request.POST.get('_submit')
if payment_id:
now = datetime.datetime.now()
payment = Payment.objects.filter(payment_id = payment_id)[0]
if not payment.is_applied:
payment.create_time = now
payment.is_applied = True
payment.save(update_fields=['create_time', 'is_applied'])
route = Route.objects.filter(route_name = PAYMENT_APPLY, company = self.user.company)[0]
document = Document.objects.get_or_create(document_id = payment_id, defaults = {'document_type':PAYMENT_TYPE,
'user':self.user,
'create_date':now})
item = Item.objects.get_or_create(document = document[0],
item_name = PAYMENT_APPLY,
route = route,
user = self.user)
#重新發起申請
if item[0].status == ITEM_REJECTED:
workflow = Workflow()
workflow.reApplyWorkflow(item[0], self.user, '')
else:#新申請
workflow = Workflow()
workflow.applyWorkflow(route, item[0], self.user)
self.message_user(u"提交申請成功", 'success')
return super(PaymentAdmin, self).post(request, *args, **kwargs)