作者 wanweibin

修复正则中 sub函数匹配字符串而不是数字

... ... @@ -38,7 +38,7 @@ class CreateProject(CreateAPIView):
serializer.save(creator=request.user, auditor=Auditor.objects.order_by('-order').all())
# 企业微信推送
obj_dict = serializer.data
url = re.sub("PK", obj_dict['id'], FRONT_URL['flow_detail'])
url = re.sub("PK", str(obj_dict['id']), FRONT_URL['flow_detail'])
first_auditor = User.objects.filter(pk=AUDITORS[0][0]).first()
wx_client.push_card(first_auditor.wx_token, url, f"{request.user.username}提交了一个产品立项申请")
wx_client.push_card(request.user.wx_token, url, u"流程创建成功")
... ... @@ -95,7 +95,7 @@ class AuditProject(UpdateAPIView):
wx_client = WxPushHelper()
full_audit_done = self._check_audit(obj)
url = re.sub("PK", obj.id, FRONT_URL['flow_detail'])
url = re.sub("PK", str(obj.id), FRONT_URL['flow_detail'])
desc = "产品立项流程所有审批已完成" if full_audit_done else f"{request.user.username}已审批完成"
if full_audit_done:
obj.is_done = True
... ...