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

'CMSToolbar' object has no attribute 'edit_mode' #522

Closed bruino closed 5 years ago

bruino commented 5 years ago

This error occurs when I search for articles. This is because the "edit_mode" attribute in CMS Toolbar is deprected in Django-CMS 3.6.

Solution

In aldryn_newsblog / views.py, in the ArticleSearchResultsList class change:

def get (self, request, * args, ** kwargs):
         self.query = request.GET.get ('q')
         self.max_articles = request.GET.get ('max_articles', 0)
         self.edit_mode = (request.toolbar and request.toolbar.edit_mode) # Change
         return super (ArticleSearchResultsList, self) .get (request, * args, ** kwargs)

...by:

def get (self, request, * args, ** kwargs):
         self.query = request.GET.get ('q')
         self.max_articles = request.GET.get ('max_articles', 0)
         self.edit_mode = (request.toolbar and toolbar_edit_mode_active (request)) # Correct!
         return super (ArticleSearchResultsList, self) .get (request, * args, ** kwargs)

SORRY MY ENGLISH.

bplociennik commented 5 years ago

@bruino thanks for added issue and solution. I checked and is resolving it. I will create PR based on this issue.

michellemark commented 5 years ago

I have this exact issue using aldryn-newsblog 2.2.1, with Django 2.1.8 and django-cms 3.6.0

tehfink commented 5 years ago

@vThaian: Same issue with aldryn-newsblog 2.2.1, Django 1.11.20, and django-cms 3.6.0.

michellemark commented 5 years ago

is there a solution coming for this issue?

makfroy commented 5 years ago

@bruino thank you for issue