django.core.exceptions.ImproperlyConfigured: Field name `tester_id` is not valid for model `WebCase`.
代码:
class WebCase(models.Model):
id = models.AutoField(primary_key=True)
casename = models.CharField("用例名称", max_length=200)
caseresult = models.BooleanField("测试结果", default=False)
casetester= models.ForeignKey(User, on_delete=models.CASCADE, verbose_name="测试负责人")
module = models.ForeignKey(Module, on_delete=models.CASCADE, verbose_name="所属模块")
update_time = models.DateTimeField("最近更改时间", auto_now=True)
create_time = models.DateTimeField("创建时间", auto_now_add=True)
class WebCaseSerializer(serializers.ModelSerializer):
module_id = serializers.IntegerField()
tester_id= serializers.IntegerField()
class Meta:
model = WebCase
fields = ('id', 'casename', 'caseresult', 'module_id', 'tester_id')
错误原因:
serializers.ModelSerializer中的字段与调用的model中的字段不一致,代码中已标注
更改后:
class WebCaseSerializer(serializers.ModelSerializer):
module_id = serializers.IntegerField()
casetester_id = serializers.IntegerField()
class Meta:
model = WebCase
fields = ('id', 'casename', 'caseresult', 'module_id', 'casetester_id')
django.core.exceptions.ImproperlyConfigured: Field name `tester_id` is not valid for model `WebCase`.的更多相关文章
- python基于Django框架编译报错“django.core.exceptions.ImproperlyConfigured”的解决办法?
下面是我具体遇到的问题和解决方法: 错误详细信息: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_IND ...
- pythoncharm 中解决启动server时出现 “django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configured”的错误
背景介绍 最近,尝试着用pythoncharm 这个All-star IDE来搞一搞Django,于是乎,下载专业版,PJ等等一系列操作之后,终于得偿所愿.可以开工了. 错误 在园子里找了一篇初学者的 ...
- 关于Django报错django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configure
报错代码:django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but se ...
- django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'. Did you install mysqlclient or MySQL-python?
Error msg: Unhandled exception in thread started by <function check_errors.<locals>.wrapper ...
- 【Django】django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
最近学习Django的过程中,在cmd打算使用python manage.py shell来测试数据的时候,当我一导入自己写的model类,就发现报了这个错误django.core.exception ...
- django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call
Error info: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, ...
- 【Django】django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?
今天创建APP的时候报这个错误django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you in ...
- django调用py报错 django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured.
完整报错信息如下 django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, bu ...
- django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE的解决办法(转)
在python的开发中,遇到了这个错误: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TA ...
随机推荐
- struts.xml 中用OGNL表达式取不到中文文件名的原因
在struts2中xml配置如下,以execl文件为例: <result name="success" type="stream"> < ...
- SSM(Spring,SpringMVC,Mybatis)框架整合项目
快速上手SSM(Spring,SpringMVC,Mybatis)框架整合项目 环境要求: IDEA MySQL 8.0.25 Tomcat 9 Maven 3.6 数据库环境: 创建一个存放书籍数据 ...
- JavaScript中通过按回车键进行数据的录入
1.代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <ti ...
- springboot+vue 实现校园二手商城(毕业设计一)
1.功能划分 2.实现的效果 2.1 登录页面 2.2 注册页面 2.3 商城首页 2.4 商品详情 2.5 购物车 2.6 订单 2.7 在线交流 2.8 公告信息 2.9 个人信息 3.后台管理界 ...
- dns隧道攻击原理及常用工具流量分析
DNS协议是一种请求应答协议,也是一种可用于应用层的隧道技术.虽然DNS流量的异常变化可能会被发现,但是在基于传统socket隧道已经濒临淘汰,TCP.UDP通信大量被安全设备拦截的大背景下,DNS. ...
- git 进阶篇
在git使用时,有时需要在公司内部搭建自己的git服务器,用于内部的版本控制. 从远程服务器到本地 先创建服务器端的空git库,将其clone到本地,再将本地的修改push到服务器端 # step1: ...
- Git创建、diff代码、回退版本、撤回代码,学废了吗
.eye-care { background-color: rgba(199, 237, 204, 1); padding: 10px } .head-box { display: flex } .t ...
- 安装 TypeScript 并编译成JS
官网: https://github.com/microsoft/TypeScript TypeScript是一种由微软开发的开源.跨平台的编程语言.它是JavaScript的超集,最终会被编译为Ja ...
- perl遍历哈希的所有健和值
my %h=("001",{name,"李白",age,"18",height,"185",weight,"6 ...
- vue3路由的使用
一.路由的概要 1.1.什么是路由? 路由就是一组映射关系,根据不同的 url 地址展示不同的内容或页面(key-value): key为路径,value可能是function或component 路 ...