这是我们组的项目
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# 导入datetime时间类型,用来接收开班时间
|
||||
from datetime import datetime
|
||||
# 从pydantic导入BaseModel(模型基类)、Field(字段校验+描述)
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
# 请求体模型:新增班级时,前端传给后台的数据结构
|
||||
class ClassAdd(BaseModel):
|
||||
class_name:str = Field(...,max_length=10,description="班级名称")
|
||||
start_time:datetime = Field(...,description="开班时间")
|
||||
head_teacher:str = Field(...,max_length=10,description="班主任")
|
||||
teacher:str = Field(...,max_length=15,description="任课老师")
|
||||
|
||||
# 响应体模型:后台返回给前端的数据
|
||||
class ClassResp(ClassAdd):
|
||||
cid: int = Field(..., description="班级主键cid")
|
||||
Reference in New Issue
Block a user