Compare commits

...

2 Commits

Author SHA1 Message Date
jeremygan2021
6129673ddc debug
All checks were successful
Deploy to Server / deploy (push) Successful in 16s
2026-03-12 12:36:25 +08:00
jeremygan2021
8b6773bb98 commit 2026-03-11 23:07:35 +08:00
2 changed files with 6 additions and 2 deletions

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

View File

@@ -7,7 +7,7 @@ django.setup()
from shop.models import ESP32Config
def populate():
# 检查数据库是否已有数据,如果有则跳过,避免每次构建都重置
# 检查数据库是否已有数据,如果有则跳过,避免每次构建都重置
if ESP32Config.objects.exists():
print("ESP32Config data already exists, skipping population.")
return