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

最新文章

  1. IOS开发基础知识--碎片49
  2. mormot 数据集转换为JSON字串
  3. sqlite3存储格式
  4. Java 基础知识点(必知必会其一)
  5. Android开发常用的一些第三方网站
  6. C#分页类
  7. C++ 16进制转10进制
  8. POJ1068Parencodings
  9. 多线程 (五)NSOperation
  10. windows 2003 远程桌面 连接输入账号密码后,只能看见蓝色屏幕和鼠标
  11. feel倍儿爽
  12. web 直播&即时聊天------阿里云、融云(三)
  13. jsp 文件使用 include指令 导入 jspf 分析,及导入jspf 文件后出现乱码问题
  14. redisLock redis分布式锁
  15. 502 VS 504
  16. Java内存管理及对Java对象管理
  17. RPCZ中的智能指针单例
  18. Judy Beta 阶段整体计划
  19. [Docker]CentOS7通过rpm包安装Docker
  20. 动态导入模块:__import__、importlib、动态导入的使用场景

热门文章

  1. Macbook上打开多个终端的方法
  2. 【译】Solr in Action 第二章
  3. Django 测试开发1
  4. Java并发包线程池之Executors、ExecutorCompletionService工具类
  5. SQL-W3School-函数:SQL UCASE() 函数
  6. 90后外挂开发者:已经有许多主播在我这里在外挂,我月入50W
  7. Java多线程——线程池使用示例
  8. 【Leetcode_easy】671. Second Minimum Node In a Binary Tree
  9. [CareerCup] 2. Bomberman 炸弹人
  10. 在Win7环境下搭建Geant4工作平台