fix order_by of user relations
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from rest_framework_simplejwt.authentication import JWTAuthentication
|
||||
from rest_framework.permissions import AllowAny, IsAuthenticated
|
||||
from apps.core.pagination import CustomPageNumberPagination
|
||||
from apps.core.exceptions import ConflictException
|
||||
from rest_framework.exceptions import APIException
|
||||
from apps.authorization.api.v1.serializers import (
|
||||
@@ -81,3 +82,14 @@ class UserRelationViewSet(viewsets.ModelViewSet):
|
||||
|
||||
queryset = UserRelations.objects.all()
|
||||
serializer_class = UserRelationSerializer
|
||||
|
||||
def list(self, request, *args, **kwargs):
|
||||
queryset = self.filter_queryset(self.get_queryset().order_by('-create_date'))
|
||||
|
||||
page = self.paginate_queryset(queryset)
|
||||
if page is not None:
|
||||
serializer = self.get_serializer(page, many=True)
|
||||
return self.get_paginated_response(serializer.data)
|
||||
|
||||
serializer = self.get_serializer(queryset, many=True)
|
||||
return Response(serializer.data)
|
||||
|
||||
Reference in New Issue
Block a user