divio / aldryn-newsblog

A combined news/weblog application for Aldryn and django CMS – part of the Essential Addons.
https://marketplace.django-cms.org/en/addons/browse/aldryn-newsblog/
Other
67 stars 118 forks source link

Unable to use 2 configurations with 2 languages. #390

Open Nekmo opened 8 years ago

Nekmo commented 8 years ago

I'm trying to use Aldryn Newsblog on 2 different sites. Each site has 2 languages. I use a different Aldryn Newsblog configuration at each site.

On the main site both languages work (aldryn_newsblog_default configuration). But in the second site fails one of the languages (other configuration).

Exception: http://dpaste.com/0MT6PJ9 django.core.urlresolvers.NoReverseMatch: 'aldryn_newsblog_default' is not a registered namespace <-- This is not the configuration I want! >:(

Pip freeze: http://dpaste.com/209FB2C

Main site: main_site.png

main_site_conf

Second site: second_site.png

second_site_conf.png

Nekmo commented 8 years ago

I think I found the problem.

NewsBlogFeaturedArticlesPlugin.get_articles uses self.app_config.namespace, but should use request.current_app

error

Nekmo commented 8 years ago

Okay, I discovered that the problem is not that. He's using the page from the other site!

I understand that Aldryn Newsblog is not the problem. The problem is DjangoCMS!

Nekmo commented 8 years ago

He has given me this error when creating a new configuration in production :(

http://dpaste.com/3EH53R3

Nekmo commented 8 years ago

Ok, I've solved adding to the static_placeholders the "site" parameter.

_aldryn_newsblog/twocolumn.html

{% extends "aldryn_newsblog/base.html" %}
{% load i18n cms_tags %}

{% block content %}
    <div class="container">
        <div class="row">
            <div class="col-md-17">
                {% if view.show_header %}
                {% static_placeholder "newsblog_feature" "site" %}
                {% endif %}
                <div class="aldryn aldryn-newsblog">
                    {% block newsblog_content %}{% endblock %}
                </div>
            </div>
            <div class="col-md-7 aldryn-newsblog aldryn-newsblog-sidebar">
                {% static_placeholder "newsblog_sidebar" "site" %}
                {% block newsblog_sidebar %}{% endblock %}
            </div>
        </div>
    </div>
    {% block newsblog_footer %}{% endblock %}
{% endblock content %}

I don't understand why this is not the default behavior of the static_placeholder. It's not even documented!