From 785fb228afedaf3e340ae92f1ce8a855d4d799ad Mon Sep 17 00:00:00 2001 From: Christian Duvholt Date: Tue, 27 Dec 2016 01:15:24 +0100 Subject: [PATCH] Move distinct to can_read --- wiki/managers.py | 2 +- wiki/views/article.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wiki/managers.py b/wiki/managers.py index 7f8df108..b97a9d9d 100644 --- a/wiki/managers.py +++ b/wiki/managers.py @@ -43,7 +43,7 @@ class ArticleQuerySet(QuerySet): q = self.filter(Q(other_read=True) | Q(owner=user) | (Q(group__user=user) & Q(group_read=True)) - ) + ).distinct() return q def can_write(self, user): diff --git a/wiki/views/article.py b/wiki/views/article.py index 1cb1f72c..aa222887 100644 --- a/wiki/views/article.py +++ b/wiki/views/article.py @@ -595,7 +595,7 @@ class SearchView(ListView): if not permissions.can_moderate( models.URLPath.root().article, self.request.user): - articles = articles.active().can_read(self.request.user).distinct() + articles = articles.active().can_read(self.request.user) return articles def get_context_data(self, **kwargs): -- 2.45.2