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. 在IntelliJ IDEA中启动tomcat出现Can't load AMD 64-bit .dll on a IA 32-bit' platform问题详解

    第一查看jdk版本 第二查看IntelliJ IDEA中运行tomcat的配置的jdk 比较两个jdk版本是否一致.或者查看tomcat是64还是32位的

  2. ES--Kibana相关操作创建索引和Mapping

    创建索引 kibana 使用如下命令进行创建索引内容. PUT test_index/ 创建别名 POST _aliases { "actions": [{ "add&q ...

  3. VUE知识点小记

    .if里面不能用import方式导入,只能用require方式引入 判断长度大于0 getIssues (vue, data) { let label = '' ) { label = `+label ...

  4. SQL-W3School-函数:SQL MIX() 函数

    ylbtech-SQL-W3School-函数:SQL MIX() 函数 1.返回顶部 1. MIN() 函数 MIN 函数返回一列中的最小值.NULL 值不包括在计算中. SQL MIN() 语法 ...

  5. Swift_IOS之提示框UIAlertController

    import UIKit class ViewController: UIViewController ,UIActionSheetDelegate{ @IBAction func btn1(_ se ...

  6. asyncio与gevent并发性能测试

    asyncio与gevent并发性能测试 在对网站进行扫描或者暴破时需要对网站进行高并发操作,然而requests+concurrent多线程性能上不太理想,了解到python用得比较多的并发库有as ...

  7. The magic method __set() must have public visibility and cannot be static in

    魔术方法 __set 用private 封装后出现问题 private function __set(){} 就是这个格式 10 错误信息就是这个:The magic method __set() m ...

  8. osg HUD 前景色

    #ifdef _WIN32 #include <Windows.h> #endif // _WIN32 #include<iostream> #include <osgV ...

  9. 123457123456#0#-----com.threeapp.headsoccer----宝宝头球大战

    com.threeapp.headsoccer----宝宝头球大战

  10. 123457123457---com.threeObj03.MaJiangertong--- 记忆翻牌益智游戏

    com.threeObj03.MaJiangertong--- 记忆翻牌益智游戏