From 6030b438a0270f37658693c36c9cb6ff29109bc7 Mon Sep 17 00:00:00 2001 From: Kirill Date: Tue, 4 Feb 2020 15:50:57 +0300 Subject: [PATCH] filtration only in moderation v2 --- apps/comment/views/back.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/comment/views/back.py b/apps/comment/views/back.py index d9128e41..bcc889be 100644 --- a/apps/comment/views/back.py +++ b/apps/comment/views/back.py @@ -19,14 +19,15 @@ class CommentLstView(generics.ListCreateAPIView): qs = models.Comment.objects.with_base_related() + if "object" not in self.kwargs and "type" not in self.kwargs: + qs = qs.filter(status=models.Comment.WAITING) + if "object" in self.kwargs: qs = qs.by_object_id(self.kwargs["object"]) if "type" in self.kwargs and self.kwargs["type"] in allowed: model = allowed[self.kwargs["type"]] qs = qs.by_content_type(self.kwargs["type"], model) - if self.kwargs["type"] == allowed["establishment"] and "object" not in self.kwargs: - qs = qs.filter(status=models.Comment.WAITING) return qs.order_by('-created')