2

I am trying to connect zinnia to django-cms 3.0

I have launched zinnia and it works just fine. Now I am trying to start changing styles. More specifically templates/zinnia/skeleton.html override.

Once I add template to override original template - url reverse starts on failing.

NoReverseMatch at /en-us/blog/
Reverse for 'entry_archive_index' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

All of the urls use namespace as in {% url 'zinnia:entry_archive_index' %} and yet reverse in shell also just fails.

What else could be done to debug it? Maybe it's because of localization?

I have urls config:

from django.conf.urls import patterns, url, include
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.conf import settings

admin.autodiscover()

urlpatterns = i18n_patterns(
    '',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^blog/', include('zinnia.urls', namespace='zinnia')),
    url(r'^comments/', include('django.contrib.comments.urls')),
    url(r'^tinymce/', include('tinymce.urls')),
    url(r'^', include('cms.urls')),
)

if settings.DEBUG:
    urlpatterns = patterns(
        '',
        url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
            {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
        url(r'', include('django.contrib.staticfiles.urls')),
    ) + urlpatterns

Settings:

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.admin',
    'django.contrib.sites',
    'django.contrib.comments',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.contenttypes',
    'my_main_django_cms_app',
    'cms',
    'mptt',
    'menus',
    'south',
    'sekizai',
    'djangocms_text_ckeditor',
    'djangocms_picture',
    'djangocms_inherit',
    'djangocms_googlemap',
    'cmsplugin_contact',

    'tinymce',
    'tagging',
    'zinnia_threaded_comments',
    'zinnia',
    'cmsplugin_zinnia',
)

And my_main_django_cms_app structure is

.
├── cms_plugins.py
├── forms.py
├── __init__.py
├── manage.py
├── models.py
├── settings.py
├── static
├── templates
│   ├── base.html
│   ├── home.html
│   └── zinnia
│       └── skeleton.html
├── urls.py
├── wsgi.py

And my versions:

Django==1.6.5
Pillow==2.4.0
South==0.8.4
argparse==1.2.1
beautifulsoup4==4.3.2
cmsplugin-contact==1.0.0
cmsplugin-zinnia==0.6
django-app-namespace-template-loader==0.1
django-blog-zinnia==0.14.1
django-classy-tags==0.5.1
django-cms==3.0
django-mptt==0.6.0
django-reversion==1.8.1
django-sekizai==0.7
django-tagging==0.3.2
django-tinymce==1.5.2
django-xmlrpc==0.1.5
djangocms-admin-style==0.2.2
djangocms-googlemap==0.0.5
djangocms-inherit==0.0.1
djangocms-picture==0.0.2
djangocms-text-ckeditor==2.1.6
gevent==1.0.1
greenlet==0.4.2
gunicorn==19.0.0
my_main_django_cms_app==0.1
html5lib==1.0b3
ipdb==0.8
ipython==2.1.0
psycopg2==2.5
pyparsing==2.0.2
pytz==2014.4
six==1.7.2
wsgiref==0.1.2
zinnia-threaded-comments==0.2
Stefan
  • 41,759
  • 13
  • 76
  • 81
JackLeo
  • 4,579
  • 9
  • 40
  • 66

2 Answers2

1

I have been trying to integrate zinnia into django cms for a few days, and here's my experience, which gets me to the point where I can use my own django cms template for zinnia, but I'm still not getting the menus provided with cmsplugin_zinnia to work.

Compared to your setup, I've made the following changes:

  • Deleted zinnia namespace, so url(r'^blog/', include('zinnia.urls', namespace='zinnia')) becomes url(r'^blog/', include('zinnia.urls')).
  • Added app_name = 'zinnia' to cmsplugin_zinnia.cmsapp.ZinniaApphook
  • Moved cms after zinnia and before cmsplugin_zinnia from settings.py in demo_cmsplugin_zinnia

With this, I can select Zinnia Weblog as Application under Advanced Settings for a new Django CMS page, and give it a unique Application Instance Name as suggested in the Django CMS docs. The name of the page or its url/slug field don't matter.

From here I can come up with my own skeleton.html that makes no reference to zinnia whatsoever, and have zinnia.base.html extend my new skeleton template.

However, at this point the cmsplugin_zinnia docs suggest:

  • 'Once the apphook is registered, you can remove the inclusion of zinnia.urls in urls.py and then restart the server to see it in full effect.',

but instead I get a NoReverseMatch at /name_of_my_blog_app/ exception, which only disappears if I include the zinnia.urls as above without namespace.

As a few weeks have passed since your original post, you may have resolved this by now. If not, I hope this points you into the right direction. In case you ran into the same issues (EntryMenu not loaded) at some point and were able to resolve, please let me know.

Stefan
  • 41,759
  • 13
  • 76
  • 81
  • Could you explain this step ```Added app_name = 'zinnia' to cmsplugin_zinnia.cmsapp.ZinniaApphook```? – JackLeo Aug 05 '14 at 05:24
  • Sure. After installation of `cmsplugin_zinnia`, go to `cms_app.py` in the main folder: https://github.com/Fantomas42/cmsplugin-zinnia/blob/develop/cmsplugin_zinnia/cms_app.py. There, you add the line `app_name= 'zinnia'` add the bottom of: `class ZinniaApphook(CMSApp)`. This is about namespacing apps vs. instances as explained here: https://docs.djangoproject.com/en/dev/topics/http/urls/#url-namespaces Sorry but the comment fields are not so great for pasting code. Let me know if you'd like me to sent the code separately. – Stefan Aug 05 '14 at 10:45
0

By using dev version for django-blog-zinnia, I see 'EntryMenu not loaded' no more. All menus related errors are gone now. As my understanding goes, this is due to inherent namespace issue in zinnia. Fantomas42 looks covering it in development version.

It has been tracked on https://github.com/django-blog-zinnia/cmsplugin-zinnia/issues/29