From ceed7c2c4a2bc217f2aa720ec596720249948e74 Mon Sep 17 00:00:00 2001 From: starnakin Date: Sun, 17 Dec 2023 20:29:04 +0100 Subject: [PATCH] fix: profile page 2 --- profiles/viewsets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/viewsets.py b/profiles/viewsets.py index 8b82afd..445e2c7 100644 --- a/profiles/viewsets.py +++ b/profiles/viewsets.py @@ -18,7 +18,7 @@ class ProfileViewSet(viewsets.ModelViewSet): permission_classes = (permissions.IsAuthenticatedOrReadOnly,) def retrieve(self, request: HttpRequest, pk=None): - if (self.queryset().filter(pk=pk)): + if (not self.queryset().filter(pk=pk).exists()): return Response({"detail": "Profile not found."}, status=status.HTTP_404_NOT_FOUND) instance = self.queryset().get(pk=pk) instance.avatar_url.name = instance.avatar_url.name[instance.avatar_url.name.find("static") - 1:]