django CMS 博客应用程序类型错误: __init__() 缺少 1 个必需的位置参数: 'on_delete'



python 3.7.3Django版本2.2.1

我刚刚开始学习Django,并通过了他们的民意调查教程。

我正在尝试安装Django CMS软件包https://github.com/nephila/djangocms-blog

运行python3 manage.py迁移后,我会遇到以下错误:

typeerror:__init __((缺少1所需的位置参数:'on_delete'

我已经阅读了有关获取typeError的建议:__init __((缺少1所需的位置参数:'on_delete'尝试在带有条目的子表之后添加父表时,但是它不能解决

如何修复它?

以下是我的模型

class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
def __str__(self):
    return self.choice_text

settings.py

INSTALLED_APPS = [
'django.contrib.sites',
'polls.apps.PollsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# CMS Blog
'cms',
'menus',
'filer',
'easy_thumbnails',
'aldryn_apphooks_config',
'cmsplugin_filer_image',
'parler',
'taggit',
'taggit_autosuggest',
'meta',
'sortedm2m',
'djangocms_blog',
]

我找到了解决方案。

CMS插件文件已弃用:https://github.com/divio/cmmsplugin-filer

它已保留在Django CMS博客的安装说明中,以获取Legacy,但应将其删除。在这里说明https://github.com/nephila/djangocms-blog/issues/431

此插件的功能已被Filer Thumbnailoption替换,因此您可以删除此位

'cmsplugin_filer_image'

来自django settings.py> installed_apps

那应该起作用。

编辑:您还需要安装最新版本的djangocms-blog

pip install djangocms-blog==1.0.0rc1

最新更新