debug
All checks were successful
Deploy to Server / deploy (push) Successful in 16s

This commit is contained in:
jeremygan2021
2026-03-12 12:36:25 +08:00
parent 8b6773bb98
commit 6129673ddc

View File

@@ -115,7 +115,11 @@ class TranscriptionTaskViewSet(viewsets.ModelViewSet):
}
if project_id:
try:
task_data['project_id'] = int(project_id)
p_id = int(project_id)
# 只有当 ID > 0 时才认为是有效的项目 ID
# 避免前端传递 0 或 Swagger 默认值导致的外键约束错误
if p_id > 0:
task_data['project_id'] = p_id
except (ValueError, TypeError):
pass # Ignore invalid project_id