from django.db import models
# Create your models here.
from utils.base_model import BaseModel
class InterFaces(BaseModel):
name = models.CharField(max_length=200, verbose_name='接口名称', help_text='接口名称')
tester = models.CharField(max_length=30, verbose_name='测试人员', help_text='测试人员')
"""
models.CASCADE: 父表中的某记录删除,父表所属的子表记录会自动删除
models.SET_NULL: 父表中的某记录删除,父表所属的子表记录会自动设置为空
models.OneToOneField: 一对一
models.ManyToManyField: 多对多
"""
project = models.ForeignKey('projects.Projects', verbose_name='', help_text='', on_delete=models.CASCADE)
# project = models.ForeignKey('projects.Projects', verbose_name='', help_text='', on_delete=models.SET_NULL,
# null=True)
"""以下内容可注释掉:有继承(BaseModel)"""
# create_time = models.DateTimeField(verbose_name='项目名称', help_text='项目名称', auto_now_add=True)
# update_time = models.DateTimeField(verbose_name='更新时间', help_text='更新时间', auto_now=True)
class Meta:
db_table = 'tb_interfaces'
verbose_name = '接口表1'
# 复数说明
verbose_name_plural = '接口表1'
def __str__(self):
return self.name