我正在运行Django 1.10.6,Django-cms 3.4.2,Django-blog-zinnia 0.18.1和cmsplugin-zinnia == 0.8.1(从github fork下载,其中实现了django 1.10兼容性)
我长期坚持这个问题并且大脑正在融化
我已经完成了所有事情like the manual says
我在项目中创建了自定义应用zinnia_integration
:
zinnia_integration / models.py
from django.db import models
from zinnia.models_bases.entry import AbstractEntry
class EntryWithNewUrl(AbstractEntry):
"""Entry with '/blog/<slug>/' URL"""
@models.permalink
def get_absolute_url(self):
return ('zinnia:entry_detail', (),
{'slug': self.slug})
class Meta(AbstractEntry.Meta):
abstract = True
zinnia_integration / views.py
from django.views.generic.detail import DetailView
from zinnia.models.entry import Entry
from zinnia.views.mixins.entry_preview import EntryPreviewMixin
from zinnia.views.mixins.entry_protection import EntryProtectionMixin
class EntryDetail(EntryPreviewMixin,
EntryProtectionMixin,
DetailView):
queryset = Entry.published.on_site()
template_name_field = 'template'
zinnia_integration / urls.py
from django.conf.urls import url
from zinnia_integration.views import EntryDetail
urlpatterns = [
url(r'^(?P<slug>[-\w]+)/$',
EntryDetail.as_view(),
name='entry_detail'),
]
我将这个urlpatter包含在我的项目urls.py
中blog_urls = ([
...
url(r'^blog/comments/', include('zinnia.urls.comments')),
url(r'^blog/', include('zinnia_integration.urls')),
#url(r'^blog/', include('zinnia.urls.entries')),
url(r'^blog/', include('zinnia.urls.archives')),
....
], 'zinnia')
urlpatterns = [
...
url(r'^', include(blog_urls)),
...
]
和我的settings.py
ZINNIA_ENTRY_BASE_MODEL = 'zinnia_integration.models.EntryWithNewUrl'
之后,我重新启动服务器并获取
NoReverseMatch at /
Reverse for 'zinnia_entry_add' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
即使我没有在子类模型中更改任何内容(EntryWithNewUrl),我仍然会收到错误!