Merge branch 'bug-published_comments_not_displayed_v2' into 'develop'
filtration only in moderation v2 See merge request gm/gm-backend!261
This commit is contained in:
commit
6bf5b2a75b
|
|
@ -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')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user