Merge pull request #63 from nephila/fix/toolbar

Don't presume the toolbar is there.
This commit is contained in:
Iacopo Spalletti 2014-12-28 15:42:30 +01:00
commit db12b6deb9
2 changed files with 2 additions and 2 deletions

View file

@ -227,7 +227,7 @@ class BasePostPlugin(CMSPlugin):
def post_queryset(self, request):
language = get_language()
posts = Post._default_manager.active_translations(language_code=language)
if not request.toolbar or not request.toolbar.edit_mode:
if not getattr(request, 'toolbar', False) or not request.toolbar.edit_mode:
posts = posts.published()
return posts

View file

@ -18,7 +18,7 @@ class BaseBlogView(ViewUrlMixin):
def get_queryset(self):
language = get_language()
queryset = self.model._default_manager.active_translations(language_code=language)
if not self.request.toolbar or not self.request.toolbar.edit_mode:
if not getattr(self.request, 'toolbar', False) or not self.request.toolbar.edit_mode:
queryset = queryset.published()
return queryset.on_site()