zinnia django中的django.contrib.comments.moderation.AlreadyModerated错误

时间:2013-09-11 07:48:30

标签: python django model zinnia

我有一个django应用程序,其中我使用django-zinnia-blog作为我的博客功能。

问题一

现在我使用最新的zinnia版本更新了github,我收到了以下错误的错误

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x941554c>>
Traceback (most recent call last):
  File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 92, in inner_run
    self.validate(display_num_errors=True)
  File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/core/management/base.py", line 280, in validate
    num_errors = get_validation_errors(s, app)
  File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/db/models/loading.py", line 166, in get_app_errors
    self._populate()
  File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/db/models/loading.py", line 72, in _populate
    self.load_app(app_name, True)
  File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/db/models/loading.py", line 96, in load_app
    models = import_module('.models', app_name)
  File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/home/user/name/virtualenvironment/apps/proname/proname/apps/zinnia/models/__init__.py", line 19, in <module>
    moderator.register(Entry, EntryCommentModerator)
  File "/home/user/Envs/zinnia/local/lib/python2.7/site-packages/django/contrib/comments/moderation.py", line 305, in register
    raise AlreadyModerated("The model '%s' is already being moderated" % model._meta.module_name)
django.contrib.comments.moderation.AlreadyModerated: The model 'entry' is already being moderated

django version -- 1.5.3

那么为什么在尝试更新AlreadyModerated最新版本时会出现zinnia错误?

问题二

以下是我的specs/setings

settings.py

ZINNIA_ENTRY_BASE_MODEL = 'proname.apps.app_name.models.EntryBase'
ZINNIA_SAVE_PING_DIRECTORIES = False
ZINNIA_PING_EXTERNAL_URLS = False

实际上我正在尝试扩展Entry模型,如下所示

from zinnia.models_bases.entry import AbstractEntry

class EntryBase(AbstractEntry):
    pass

    class Meta(AbstractEntry.Meta):
        abstract = True
        verbose_name_plural = _("Entry")
        verbose_name_plural = _("Entries")

    def __unicode__(self):
        return u'Entry %s' % self.title

django version -- 1.4.5

当我使用上面的django版本时,我会得到一个额外的错误以及一个

raise ImproperlyConfigured('%s cannot be imported' % model_path)

django.core.exceptions.ImproperlyConfigured: zinnia.models_bases.entry.AbstractEntry cannot be imported

所以任何人都可以让我知道解决上述问题,如

更新到最新的github百日草代码时

AlreadyModerated

尝试扩展Entry模型?

并使百日草正常工作?

2 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,我找出了将百日草的版本更改为0.14.3

的问题
  

Zinnia 0.15仅适用于django 1.7

     

请改用v0.14.3。

     

https://github.com/Fantomas42/django-blog-zinnia/issues/388

答案 1 :(得分:0)

我也遇到过这个问题。我能够修复它的方法是链接回原始zinnia包中的model_bases文件夹。在我的网站&#39; zinnia&#39;文件夹(存储更新的南迁移的位置):

$ ln -sf <python-path>/lib/python2.7/site-packages/zinnia/models_bases .