在newforms admin中Django ImageField core=False

2024-05-14 07:47:05 发布

您现在位置:Python中文网/ 问答频道 /正文

在向newforms admin的转换过程中,我很难弄清楚如何为ImageFields指定core=False。在

我得到以下错误:

TypeError: __init__() got an unexpected keyword argument 'core'

[编辑]然而,通过删除核心参数,我得到一个“thisfield is required.”错误出现在管理界面上。如何使用newforms admin完成core=False的目的?在


Tags: coreanfalse编辑admininit过程错误
3条回答

为了去掉“thisfield is required”,您需要使用blank=True(如果不是CharField,也可以使用null=True)使其不需要。在

core属性不再使用。在

来自Brian Rosner's Blog

You can safely just remove any and all core arguments. They are no longer used. newforms-admin now provides a nice delete checkbox for exisiting instances in inlines.

这很简单。我几年前就开始遇到这个问题了。基本上,只需删除模型中ImageField中的“core=True”参数,然后按照here的说明转换为newforms管理员使用的内容。在

相关问题 更多 >

    热门问题