fix(gitea): 申请记录补传 UserGiteaAccountUUID 主键,修复 Duplicate entry '\x00'
创建 UserGiteaAccount 时漏传主键 UserGiteaAccountUUID,UUIDField 无默认值导致主键存全零字节,第二次申请触发 MySQL 主键冲突;与 mail.py 模式对齐补 uuid4().bytes
This commit is contained in:
1 parent
fb72a3a1e4
commit
e970a610fc
1 file changed
+2
@@ -14,6 +14,7 @@ URL 路径最后一段作为 action 名称,无需前端额外传 Action 字段
|
||||
"""
|
||||
import logging
|
||||
import re
|
||||
import uuid
|
||||
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
from rest_framework.response import Response
|
||||
@@ -187,6 +188,7 @@ class GiteaApplyView(ELTAuthenticatedAPIView):
|
||||
return Response({'code': 1, 'msg': f'加入组织失败: {e}'}, status=502)
|
||||
|
||||
UserGiteaAccount.objects.create(
|
||||
UserGiteaAccountUUID=uuid.uuid4().bytes,
|
||||
UserUUID=request.user,
|
||||
GiteaLogin=login,
|
||||
GiteaUserId=gitea_user_id,
|
||||
|
||||
Reference in new issue
Block a user