Merge pull request #234 from nephila/feature/fix_onsite

Fix onsite filter
This commit is contained in:
Iacopo Spalletti 2016-04-29 09:19:37 +02:00
commit e44b5eb953
2 changed files with 5 additions and 1 deletions

View file

@ -44,7 +44,7 @@ class BaseBlogView(AppConfigMixin, ViewUrlMixin):
if not getattr(self.request, 'toolbar', False) or not self.request.toolbar.edit_mode:
queryset = queryset.published()
setattr(self.request, get_setting('CURRENT_NAMESPACE'), self.config)
return queryset
return queryset.on_site()
def get_template_names(self):
template_path = (self.config and self.config.template_prefix) or 'djangocms_blog'

View file

@ -70,6 +70,10 @@ class ViewTest(BaseTest):
self.assertContains(response, context['post_list'][0].get_absolute_url())
self.assertEqual(getattr(request, BLOG_CURRENT_NAMESPACE), self.app_config_1)
posts[1].sites.add(self.site_2)
self.assertTrue(view_obj.get_queryset().count(), 2)
self.assertFalse(posts[1] in view_obj.get_queryset())
with smart_override('it'):
request = self.get_page_request(pages[1], self.user, lang='it', edit=True)
view_obj = PostListView()