filtration only in moderation
This commit is contained in:
parent
d0311ec974
commit
f3a5605111
|
|
@ -17,7 +17,7 @@ class CommentLstView(generics.ListCreateAPIView):
|
|||
"establishment": Establishment.__name__.lower()
|
||||
}
|
||||
|
||||
qs = models.Comment.objects.with_base_related().filter(status=models.Comment.WAITING)
|
||||
qs = models.Comment.objects.with_base_related()
|
||||
|
||||
if "object" in self.kwargs:
|
||||
qs = qs.by_object_id(self.kwargs["object"])
|
||||
|
|
@ -25,6 +25,8 @@ class CommentLstView(generics.ListCreateAPIView):
|
|||
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