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

Plugins of article always the same as parent page #472

Closed claudio-vellage closed 5 years ago

claudio-vellage commented 7 years ago

I'm currently trying to get this blog plugin to work with Django 1.10, using the master branch of this repo. My pages have the following layout:

When I create an test article and afterwards add a plugin to the Blog page which shows the most recent articles, I can see the preview of the article I've just created. If I now click on the article, I get redirected to the correct page, but the article is not empty, instead all plugins from the "Blog" page are shown.

If I now remove the plugins from the article and add a test plugin, the same will happen to the parent page. I am not sure what exactly is causing this problem. I think that I am not really looking at the article as expected, but looking at the parent page (Blog), just with a different domain.

I checked my urls.py, but I've never added any aldryn specific urls, so I'm not sure what's going wrong here.

artforlife commented 7 years ago

I second that this issue exist and am subscribing to the thread.

claudio-vellage commented 7 years ago

As discussed in #440, I'm facing this problem with all users, because I can't even edit the article detail view, I'm always seeing the list view, so I could never publish a version which would differ for anonymous users.

artforlife commented 7 years ago

I am seeing the problem only for anonymous users. For administrator, it works properly, as far as I can tell.

claudio-vellage commented 7 years ago

This is probably caused, because the article_list.html and article_detail.html templates are never used. I wonder how to configure the templates correctly?

claudio-vellage commented 7 years ago

I found the problem. My base template did not contain a block content and therefore the templates have never been loaded correctly.

I suggest that the docs should definitely mention something about this.

I am not sure whether this issue is related to the behavior @artforlife is experiencing.

artforlife commented 7 years ago

@LRH539 What did you do exactly? Did you add {% block content %} to the template? Which template?

claudio-vellage commented 7 years ago

@artforlife In my project directory, I have a template subdirectory, which contains all templates I am using with DjangoCMS. I am using a base.html template, which I use for all other templates such as blog.html.

Aldryn-Newsblog also uses a base.html and a article_list.html and a article_detail.html, which both extend their base.html. Their base.html (aldryn_newsblog/base.html) contained a {% block content %}, while my base.html contained a {% block main_content %}. Because I wanted to keep everything as is, to keep the design of the website consistent, I went into my blog.html, which extends my base.html and replaced a placeholder which I used to add my plugins with a {% block content %}{% endblock %} statement.

After I've done that, aldryn_newsblog extended my templates automagically and finally the Newsblog_Article_Content and Newsblog_Article_Social placeholders showed up. Now if I add my content to these Areas, everything works as intended for both my list view and my detail views.

If it remains unclear what I've done, I can send some code snippets.

artforlife commented 7 years ago

@LRH539 Which file does your blog.html correspond to? I have the following structure, which pretty much follows the original tutorial (or at least a version thereof from sometime within the last 6-7 months).

screen shot 2017-09-19 at 4 17 38 pm
claudio-vellage commented 7 years ago

@artforlife I have the following layout for my templates:

shot1

The sub folder contains my base.html and I have not customized the aldryn_newsblog templates yet, so they are not in my project folder.

My blog.html contains the following code:

{% extends "sub/base.html" %}

{% block main_content %}
...
</header>
{% block content %}{% endblock %}
<footer>
...
{% endblock %}

The main_content block is present in sub/base.html while the other content block is present in the aldryn_newsblog/base.html (in case you haven't modified them yet).

I wasn't aware there's an official tutorial, I've only used the installation guide so far.

Edit: Didn't mention it, because I thought it's probably obvious, but I've set the template for the page with the apphook AldrynNewsblog to blog.html.

artforlife commented 7 years ago

@LRH539 I was referring to this tutorial. Is that what you have in mind?

If that is what you are using, it would be really helpful (to me and probably others who encounter the same problem) if we can specify where in the tutorial one needs an extra step to avoid this issue.

I have considered rebuilding using Django 1.10 from scratch, but have not committed to it yet.

claudio-vellage commented 7 years ago

I've used this website, the official docs instead of a tutorial. The tutorial does indeed mention something about {% block content %}{% endblock %}, but the docs don't and I the info should be added.

The official docs can be found here: http://aldryn-newsblog.readthedocs.io/en/latest/introduction.html

artforlife commented 7 years ago

@LRH539 I see. By the way, did you grab every module from their respective repositories or you only did it with Django?

claudio-vellage commented 7 years ago

I installed most applications with pip install MODULENAME, only aldryn-newsblog required me to use the latest version from github, because I didn't want to downgrade my stack to Django 1.9.

artforlife commented 7 years ago

After tinkering with this for awhile I did the following:

  1. Installed latest Django 1.10 from its repository (branch called stable/1.10.x)
  2. Installed latest Django CMS from its repository
  3. Installed Aldryn NewsBlog from its repository
  4. I had to comment out the Aldryn Events becase it was getting the error similar to the one mentioned in here. That is, I suspect that the error shows up because Aldryn Events has not been made compatible with Django 1.10.

After the above steps, the problem fixed itself! That is, in my case the problem didnt appear to be related to improper code in templates. Instead, it was related to the behavior of the modules themselves.

tehfink commented 5 years ago

Having the same problem in:

It seems the admin's Section settings for "PERMALINK TYPE" & "NON-PERMALINK HANDLING" are ignored, and everything after the apphooked url is swallowed – thus even non-existent urls return the list view (and the template variable "detail_view" is never set, as LRH539 mentioned above).