django 报错

django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form ResumeForm needs updating.

一搜网上的回答大都是说加上

fields = '__all__'

看下django.forms.models 中判断报错的源码如下

            # If a model is defined, extract form fields from it.
if opts.fields is None and opts.exclude is None:
raise ImproperlyConfigured(
"Creating a ModelForm without either the 'fields' attribute "
"or the 'exclude' attribute is prohibited; form %s "
"needs updating." % name
)

意思就是定义的model没字段 但我有的啊

class ResumeForm(forms.ModelForm):
class Meta:
model = Resume
field = ('title', 'body',)

再仔细一看 fields 写成 field ...

Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form ResumeForm needs updating.的更多相关文章

  1. Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

    调试网站时,异常出现:Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive. S ...

  2. .Net Attribute详解(上)-Attribute本质以及一个简单示例

    Attribute的直接翻译是属性,这和Property容易产生混淆,所以一般翻译成特性加以区分.Attribute常常的表现形式就是[AttributeName], 随意地添加在class, met ...

  3. C# Attribute(中)——Attribute本质论

      小序:                   上篇里,我们把Attribute“粘”在类的成员方法上show了一把,让Attribute跟大家混了个脸儿熟.中篇里,我们将探讨“究竟什么是Attrib ...

  4. C# Attribute (上)——Attribute初体验

      原始出处 .作者信息和本声明.否则将追究法律责任.http://liutiemeng.blog.51cto.com/120361/29201 小序:          注意:本次小序颇长而且没什么 ...

  5. boolean attribute(布尔值属性) attribute vs property

    boolean attribute(布尔值属性) boolean attribute     HTML - Why boolean attributes do not have boolean val ...

  6. Django: ModelForm中Meta的fields等成员介绍

    class MyForm(forms.ModelForm): realname = forms.CharField() phone = forms.CharField() class Meta: mo ...

  7. 特性attribute,声明和使用attribute,应用attribute,AOP面向切面,多种方式实现AOP

    1 特性attribute,和注释有什么区别2 声明和使用attribute3 应用attribute4 AOP面向切面5 多种方式实现AOP ---------------------------- ...

  8. Viser报错:dodge is not support linear attribute, please use category attribute!

    遇到这样的问题是因为x轴数据不能为为连续性的日期(日期格式为:YYYY-MM-DD),需要设置为分类属性(cat),有一些可能设置为timeCat,看具体情况 scale 参数支持以下类型 • ide ...

  9. python---django中form组件(2)自定制属性以及表单的各种验证,以及数据源的实时更新,以及和数据库关联使用ModelForm和元类

    自定义属性以及各种验证 分析widget: class TestForm(forms.Form): user = fields.CharField( required = True, widget = ...

随机推荐

  1. PHP fopen/file_get_contents与curl性能比较

    PHP中fopen,file_get_contents,curl 函数的区别: 1.fopen/file_get_contents 每次请求都会重新做 DNS 查询,并不对 DNS 信息进行缓存. 但 ...

  2. Java-JUC(零):Java:现有线程T1/T2/T3,如何确保T1执行完成之后执行T2,T3在T2执行完成之后执行。

    要实现多个线程执行完成先后,就要知道如何实现线程之间的等待,java线程等待实现是join.java的jdk中join方法实现如下: public final synchronized void jo ...

  3. python笔记9 线程进程 threading多线程模块 GIL锁 multiprocessing多进程模块 同步锁Lock 队列queue IO模型

    线程与进程 进程 进程就是一个程序在一个数据集上的一次动态执行过程.进程一般由程序.数据集.进程控制块三部分组成.我们编写的程序用来描述进程要完成哪些功能以及如何完成:数据集则是程序在执行过程中所需要 ...

  4. 最新解决Chrome(版本76.0.3809.100) “请停用以开发者模式运行的扩展程序”的方法

    最新解决Chrome(版本76.0.3809.100) “请停用以开发者模式运行的扩展程序”的方法 最近在远景论坛上发现了最新的解决Chrome浏览器提示:请停用以开发者模式运行的扩展程序的问题.该方 ...

  5. java获取两个日期之间的所有日期

    java获取两个日期之间的所有日期   解决方法: 1.核心方法 private List<String> getBetweenDates(String start, String end ...

  6. 简单模拟 Promise

    class promise { constructor(fn) { this.data = null; this.err = null; this.isPromise = false; this.er ...

  7. centOS 8 安装Hadoop

    1.安装环境 本教程使用 CentOS 8 64位 作为系统环境,请自行安装系统. 本教程基于原生 Hadoop 2,在 Hadoop 2.8.5 版本下验证通过,可适合任何 Hadoop 2.x.y ...

  8. MySQL性能优化最佳实践20条

    今天,数据库的操作越来越成为整个应用的性能瓶颈了,这点对于Web应用尤其明显.关于数据库的性能,这并不只是DBA才需要担心的事,而这更是我们程序员需要去关注的事情.当我们去设计数据库表结构,对操作数据 ...

  9. $(this).addClass('class').siblings('class').removeClass('class')的作用

    $(this).addClass('class'):为当前元素添加'class'类(供选择器使用 - - ) $(this).siblings('class'):查找当前元素的所有类名为 " ...

  10. css3 animation 点亮灯光效果

    <style> .wrap .bulb { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50% ...