Skip to content

Commit

Permalink
Merge branch 'main' of github.com:HE-Arc/kodecupid
Browse files Browse the repository at this point in the history
  • Loading branch information
Thombrix committed May 3, 2024
2 parents 65f6091 + 4c954eb commit fa6a019
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions backend/kodecupidapp/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ def add_picture(self, request):
@action(detail=True, methods=['get'])
def pictures(self, request, pk=None):
user = self.get_object()
queryset = Picture.objects.filter(user=user.id).exclude(id=user.pfp.id)
serializer = PictureSerializer(queryset, many=True)

if user.pfp:
queryset = Picture.objects.filter(user=user.id).exclude(id=user.pfp.id)
serializer = PictureSerializer(queryset, many=True)
else:
return Response({"message": "User does not have a profile picture."}, status=status.HTTP_404_NOT_FOUND)
return Response(serializer.data)

0 comments on commit fa6a019

Please sign in to comment.