processinstance.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:django-lb-workflow 作者: vicalloy 项目源码 文件源码
def detail(request, pk, template_name=None, ext_ctx={}):
    instance = ProcessInstance.objects.get(pk=pk)
    views = import_wf_views(instance.process.code)
    is_print = ext_ctx.get('is_print')
    __ext_param_process = getattr(views, '__ext_param_process', None)
    ctx = {}
    ctx.update(ext_ctx)

    if not can_view_wf(instance, request.user, ext_param_process=__ext_param_process):
        messages.info(request, 'No permission to view this process')
        return redirect(reverse('wf_my_wf'))

    user_wf_info = user_wf_info_as_dict(instance.content_object, request.user)
    ctx.update(user_wf_info)

    if not is_print and instance.cur_node.can_edit \
            and instance.cur_node.audit_view_type == 'edit' \
            and ext_ctx['task'] and instance.cur_node.resolution == 'started':
        return redirect(reverse('wf_edit', args=[instance.pk]))
    detail_func = getattr(views, 'detail', _default_detail)
    ret = detail_func(request, instance, ext_ctx=ctx)
    if isinstance(ret, dict):
        ret.update(ctx)
        return _default_detail(request, instance, ret, template_name)
    return ret
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号