Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form ResumeForm needs updating.
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.的更多相关文章
- Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
调试网站时,异常出现:Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive. S ...
- .Net Attribute详解(上)-Attribute本质以及一个简单示例
Attribute的直接翻译是属性,这和Property容易产生混淆,所以一般翻译成特性加以区分.Attribute常常的表现形式就是[AttributeName], 随意地添加在class, met ...
- C# Attribute(中)——Attribute本质论
小序: 上篇里,我们把Attribute“粘”在类的成员方法上show了一把,让Attribute跟大家混了个脸儿熟.中篇里,我们将探讨“究竟什么是Attrib ...
- C# Attribute (上)——Attribute初体验
原始出处 .作者信息和本声明.否则将追究法律责任.http://liutiemeng.blog.51cto.com/120361/29201 小序: 注意:本次小序颇长而且没什么 ...
- boolean attribute(布尔值属性) attribute vs property
boolean attribute(布尔值属性) boolean attribute HTML - Why boolean attributes do not have boolean val ...
- Django: ModelForm中Meta的fields等成员介绍
class MyForm(forms.ModelForm): realname = forms.CharField() phone = forms.CharField() class Meta: mo ...
- 特性attribute,声明和使用attribute,应用attribute,AOP面向切面,多种方式实现AOP
1 特性attribute,和注释有什么区别2 声明和使用attribute3 应用attribute4 AOP面向切面5 多种方式实现AOP ---------------------------- ...
- Viser报错:dodge is not support linear attribute, please use category attribute!
遇到这样的问题是因为x轴数据不能为为连续性的日期(日期格式为:YYYY-MM-DD),需要设置为分类属性(cat),有一些可能设置为timeCat,看具体情况 scale 参数支持以下类型 • ide ...
- python---django中form组件(2)自定制属性以及表单的各种验证,以及数据源的实时更新,以及和数据库关联使用ModelForm和元类
自定义属性以及各种验证 分析widget: class TestForm(forms.Form): user = fields.CharField( required = True, widget = ...
随机推荐
- 【Oracle/Java】批量删除16张十万数据的表 单线程耗时45秒 多线程耗时38秒
昨天做了插入的单线程多线程比较,今天做个删除的. 单线程批量删除类代码: package com.hy.delete.singlethread; import java.sql.Connection; ...
- 将bat文件注册成为系统服务
第一章 注册系统服务准备 1.1 注册系统服务前准备 1.1.1 涉及第三方软件 Bat_To_Exe_Converter.exe (将*.bat文件转化为可执行*.exe文件) insts ...
- Java设计模式: 单例模式
1.需要传递参数: public class Singleton{ private volatile static Singleton instance = null; private int val ...
- Python使用设计模式中的责任链模式与迭代器模式的示例
Python使用设计模式中的责任链模式与迭代器模式的示例 这篇文章主要介绍了Python使用设计模式中的责任链模式与迭代器模式的示例,责任链模式与迭代器模式都可以被看作为行为型的设计模式,需要的朋友可 ...
- .NET实体框架EF之CodeFirst
ADO.NET Entity Framework 以 Entity Data Model (EDM) 为主,将数据逻辑层切分为三块,分别为 Conceptual Schema, Mapping Sch ...
- Composer更新慢的终极解决方案-转
转自:http://blog.csdn.net/fishermanmax/article/details/51975692 Packagist 镜像 请各位使用本镜像的同学注意: 本镜像已经依照 co ...
- 【C# 开发技巧】番外篇故事-我是一个线程
我是一个线程 我是一个线程,一出生就被编了一个号——0x3704,然后被领到一间昏暗的屋子里,在这里,我发现了很多和我一模一样的同伴.我身边的同伴0x6900待的时间比较长,他带着沧桑的口气对我说:“ ...
- WEB前端动态背景集
本资源是我在源代码网站上发现的,内附几十种背景动态特效,我单独提取出来精品背景特效在此分享,文件里有20多种精品动态效果,本人觉得可用作于个人博客主页背景,登陆页面背景等,有20多个背景特效,非常漂亮 ...
- SMOS数据产品介绍与下载方法
1. SMOS数据介绍 The Soil Moisture and Ocean Salinity (SMOS) 卫星是欧空局发射的一颗以探测地球土壤水含量以及海表盐度为目标的卫星,卫星所搭载的唯一载荷 ...
- [翻译向] 当flush privileges生效时
#前言: 最近频繁在mysql权限控制这里栽跟斗,在翻阅了一些资料之后,简单地翻译一下官网关于flush privileges的描述,抛砖引玉. #翻译正文: If the mysqld serv ...