每天努力一点点,坚持下去 ------ 博客首页

报错解决:user.Case: (models.E020) The 'Case.check()' class method is currently overridden by

Django在启动时报错,如下:

user.Case: (models.E020) The 'Case.check()' class method is currently overridden by <django.db.models.query_utils.DeferredAttribute object at 0x0000020331E0AE20>.

意思是说:在user.Case.check()在执行的过程中被【django.db.models.query_utils.DeferredAttribute】覆盖了

 1 class Case(BaseModel):
 2     '''用例表'''
 3     title = models.CharField(verbose_name='用例标题', max_length=100)
 4     project = models.ForeignKey(Project, on_delete=models.DO_NOTHING, db_constraint=False, verbose_name='归属项目')
 5     interface = models.ForeignKey(Interfaces, on_delete=models.DO_NOTHING, db_constraint=False, verbose_name='接口')
 6     user = models.ForeignKey(User, on_delete=models.DO_NOTHING, db_constraint=False, verbose_name='创建用户')
 7     method_choice = (
 8         (1, 'POST'),
 9         (2, 'GET'),
10         (3, 'DELETE'),
11         (4, 'PUT'),
12     )
13     method = models.SmallIntegerField(choices=method_choice, verbose_name='请求方式')
14     cache_field = models.CharField(verbose_name='缓存字段', max_length=128, null=True, blank=True)
15     checks = models.CharField(verbose_name='校验点', max_length=512)
16     params = models.CharField(verbose_name='请求参数', max_length=2048, null=True, blank=True)
17     headers = models.CharField(verbose_name='请求头信息', max_length=2048, null=True, blank=True)
18     is_json = models.BooleanField(verbose_name='参数是否是json', default=False)
19     json = models.CharField(verbose_name='json类型参数', max_length=2048, null=True, blank=True)
20     status_choice = (
21         (1, '通过'),
22         (2, '未运行'),
23         (3, '运行中'),
24         (999, '失败')
25     )
26     status = models.SmallIntegerField(choices=status_choice, verbose_name='用例状态',
27                                       default=2)  # 记录上一次的状态 每次执行后需要更新下这个表的这个字段
28     report_batch = models.CharField(verbose_name='最后一次执行的批次号', null=True, max_length=512, blank=True)

 

 通过尝试注释15行后,是不报错的,但是这样也不行,还有使用这个参数,尝试了check末尾+s,结果正常了

posted @ 2023-04-18 22:02  他还在坚持嘛  阅读(83)  评论(0编辑  收藏  举报