diagnose-backend/diagnose/models.py
pzc-x99 f56b66d8f1 /health/
/error_code_map/
/ec_user/*
/diagnose/*
/admin/*
2025-02-28 23:05:31 +08:00

19 lines
846 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from django.db import models
from ec_user.models import EcUser
# Create your models here.
class Papers(models.Model):
STATUS_CHOICES = (
('C', '任务创建'),
('P', '生成中'),
('D', '已完成')
)
uuid = models.CharField(max_length=100) # 试卷的唯一标识符
# 定义一个与EcUser一对多关联的外键
user = models.ForeignKey(EcUser, on_delete=models.CASCADE) # 当EcUser被删除时关联的Papers也会被删除
status = models.CharField(max_length=1, choices=STATUS_CHOICES, default='C') # 默认值设置为'C'
created_at = models.DateTimeField(auto_now_add=True,null=True, blank=True) # 创建时间
updated_at = models.DateTimeField(auto_now=True,null=True, blank=True) # 更新时间
def __str__(self):
return self.user.username + '的试卷'