fix: profiles list display new profiles

This commit is contained in:
starnakin 2023-12-11 14:36:36 +01:00
parent 9c1dd30db7
commit d8a279f4d8

View File

@ -11,7 +11,7 @@ from .serializers import ProfileSerializer
from .models import ProfileModel
class ProfileViewSet(viewsets.ModelViewSet):
queryset = ProfileModel.objects.all()
queryset = ProfileModel.objects.all
serializer_class = ProfileSerializer
parser_classes = (MultiPartParser, FormParser)
permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
@ -23,7 +23,7 @@ class ProfileViewSet(viewsets.ModelViewSet):
status=status.HTTP_200_OK)
def list(self, request: HttpRequest):
serializer = ProfileSerializer(self.queryset, many=True)
serializer = ProfileSerializer(self.queryset(), many=True)
for profile in serializer.data:
profile["avatar_url"] = profile["avatar_url"][profile["avatar_url"].find("static") - 1:]
return Response(serializer.data)