Remove: list override for PostListView
This commit is contained in:
parent
2bc6d4ac21
commit
93d3f4979d
1 changed files with 0 additions and 9 deletions
|
@ -21,15 +21,6 @@ class PostListView(generics.ListAPIView):
|
|||
queryset = PostModel.objects.filter(mature=False)
|
||||
return queryset.order_by("-date_created")
|
||||
|
||||
def list(self, request, *args, **kwargs):
|
||||
"""
|
||||
Overriding list() allows us to return a custom response structure,
|
||||
for example including a count and a key 'posts' instead of DRF's default 'results'.
|
||||
"""
|
||||
queryset = self.filter_queryset(self.get_queryset())
|
||||
serializer = self.get_serializer(queryset, many=True)
|
||||
data = {"count": queryset.count(), "posts": serializer.data}
|
||||
return Response(data)
|
||||
|
||||
|
||||
class PostDetailView(generics.RetrieveAPIView):
|
||||
|
|
Loading…
Add table
Reference in a new issue