【问题标题】:'content' cannot be specified for Article model form as it is a non-editable field无法为文章模型表单指定“内容”,因为它是不可编辑的字段
【发布时间】:2017-09-19 16:46:06
【问题描述】:

我目前正在升级 Django 1.9 站点以使用 Django 1.10。我很想升级到 Django 1.11,但是网站使用的一些包还不支持它。

无论哪种方式,当我转到 localhost:8000 时都会收到以下错误

FieldError 在/

不能为文章模型表单指定“内容”,因为它是 不可编辑的字段

请求方法:GET 请求地址:http://localhost:8000/Django 版本:1.10.9 异常类型:FieldError 异常值:

不能为文章模型表单指定“内容”,因为它是 不可编辑的字段

异常位置: /xxx-env/lib/python3.6/site-packages/django/forms/models.py 在 fields_for_model,第 143 行

该站点正在运行 Django CMS 3.4.4 以及其他 Aldryn 插件,所有这些都使用 pip install 进行更新。

有问题的代码是这样的:

    if (fields is not None and f.name in fields and
            (exclude is None or f.name not in exclude)):
        raise FieldError(
            "'%s' cannot be specified for %s model form as it is a non-editable field" % (
                f.name, model.__name__)
        )
    continue

我想要一些关于如何解决此问题的提示或说明。

【问题讨论】:

    标签: python django django-cms divio


    【解决方案1】:

    我能够通过安装aldryn-newsblog 的最新主版本来克服这个错误: pip install git+https://github.com/aldryn/aldryn-newsblog.git@master

    您也可以观看来自herehere 的讨论。

    【讨论】:

      猜你喜欢
      • 2019-05-28
      • 2020-10-22
      • 1970-01-01
      • 2021-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-25
      • 2012-02-08
      相关资源
      最近更新 更多