报错解决: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,结果正常了
本文来自博客园,作者:他还在坚持嘛,转载请注明原文链接:他还在坚持嘛 https://www.cnblogs.com/brf-test/p/17331370.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架
2020-04-18 Python 两个list合并成一个字典