djangocms-blog
djangocms-blog copied to clipboard
NoReverseMatch for Translation
I am trying to provide a two-language version of a djangocms-blog I set up.
Steps to reproduce:
- Install Django CMS and djangocms-blog according to manual
- set up two languages
- Create Page "blog" and attach apphook to both languages
- try to publish both
Versions
Django CMS 3.5.3 Django 1.11 Python 3.6.7
Expected behaviour
Both Blog pages should display overview of blog entries
Actual behaviour
Default language (language in which the blog entries were created in) shows up, when I switch to second language it throws a NoReverseMatch Error:
Reverse for 'post-detail' not found. 'post-detail' is not a valid view function or pattern name.
Additional Information
- Apphook Config has translations for both language (as far as I understood), both do display the same for "namespace"
- I cannot publish the page "Blog" which has the apphook attached to it in the second language, it just stays unpublished
- Error seems to occur when accessing {{ post.get_absolute_url }} in the template post-detail.html
setup.py:
LANGUAGES = ( ('de', gettext('de')), ('en', gettext('en')), )
CMS_LANGUAGES = { 1: [ { 'code': 'de', 'name': gettext('de'), 'redirect_on_fallback': True, 'public': True, 'hide_untranslated': False, }, { 'code': 'en', 'name': gettext('en'), 'redirect_on_fallback': True, 'public': True, 'hide_untranslated': False, }, ],
'default': { 'redirect_on_fallback': True, 'public': True, 'hide_untranslated': False, }, }
urls.py:
urlpatterns = [ url(r'^sitemap.xml$', sitemap, {'sitemaps': {'cmspages': CMSSitemap}}), ]
urlpatterns += i18n_patterns( url(r'^admin/', include(admin.site.urls)), # NOQA url(r'^', include('cms.urls')), url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')), )
if settings.DEBUG: urlpatterns = [ url(r'^media/(?P
.*)$', serve, {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), ] + staticfiles_urlpatterns() + urlpatterns
@whyronimus thanks for the report, which are the djangocms-blog and django-parler in the virtualenv? the root issue is the page not being published in the second language: are all the ancestors of the blog page published on all the languages Namespace is the same for all the languages, so this is normal
Had exact this problem. In my case the menu/page item with the Blog/News app hock was not published for the German language. After fixing this it works.