代码:

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`.的更多相关文章

  1. python基于Django框架编译报错“django.core.exceptions.ImproperlyConfigured”的解决办法?

    下面是我具体遇到的问题和解决方法: 错误详细信息: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_IND ...

  2. pythoncharm 中解决启动server时出现 “django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configured”的错误

    背景介绍 最近,尝试着用pythoncharm 这个All-star IDE来搞一搞Django,于是乎,下载专业版,PJ等等一系列操作之后,终于得偿所愿.可以开工了. 错误 在园子里找了一篇初学者的 ...

  3. 关于Django报错django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configure

    报错代码:django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but se ...

  4. 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 ...

  5. 【Django】django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.

    最近学习Django的过程中,在cmd打算使用python manage.py shell来测试数据的时候,当我一导入自己写的model类,就发现报了这个错误django.core.exception ...

  6. 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, ...

  7. 【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 ...

  8. 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 ...

  9. django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE的解决办法(转)

    在python的开发中,遇到了这个错误: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TA ...

随机推荐

  1. python-绘图与可视化

    python 有许多可视化工具,但本书只介绍Matplotlib.Matplotlib是一种2D的绘图库,它可以支持硬拷贝和跨系统的交互,它可以在python脚本,IPython的交互环境下.Web应 ...

  2. iptables使用详解

    iptables使用详解 @(linux)[iptables] 前言 最近买了一个VPS,并在上面搭了DOCKER,然后再DOCKER中安装Mysql.但只要将网络端口映射到宿主机上,那么外部网络就可 ...

  3. 【神经网络】丢弃法(dropout)

    丢弃法是一种降低过拟合的方法,具体过程是在神经网络传播的过程中,随机"沉默"一些节点.这个行为让模型过度贴合训练集的难度更高. 添加丢弃层后,训练速度明显上升,在同样的轮数下测试集 ...

  4. Vue2基础知识学习

    Vue2基础知识学习 01.初识 new Vue({ el: '#root', //用于指定当前Vue实例为哪个容器服务,值通常为css选择器符 data () { return { } } }); ...

  5. Java读取txt文件、excel文件的方法

    Java读取txt文件.excel文件的方法 1.读取txt文件 public static String getFileContent(String filePath,String charset) ...

  6. Eclipse Python IDE安装

    时隔一年,曾经的AI工程师微专业课程也忘了大半,如今终于有闲心重温人工智能的相关知识与项目.先从Eclipse安装开始. 首先下载JDK,进入JDK官网下载最新版本的JDK并安装:https://ww ...

  7. 【DL论文精读笔记】ResNet

    Abstract 利用残差学习架构释放深度 152层深度是VGG的8倍,且复杂度更低 ImageNet上的错误率3.57% 在ILSVRC和2015COCO竞赛,在多项任务拿到第一 3.1 Intro ...

  8. UBOOT编译--- UBOOT的编译和链接选项详解(六)

    1. 前言 UBOOT版本:uboot2018.03,开发板myimx8mmek240. 2. 函数 cc-option 编译选项变量cc-option 定义在 scripts/Kbuild.incl ...

  9. Training: ASCII

    题目链接:http://www.wechall.net/challenge/training/encodings/ascii/index.php 让我们使用标准的美国信息交换编码格式解下面的ASCLL ...

  10. CSP 记

    csp 开考建好文件夹编译器不能用搞了半天换了台电脑 四道题看完一个小时过去了 第一题不会正解写了部分分还有点悬 第二题写暴力因为一个小错误调了半天 看时间不多了已经有点慌了 也没想正解直接开了下一题 ...