block: use of blocker instead of querying the db again

This commit is contained in:
AdrienLSH 2024-04-16 14:01:13 +02:00
parent 42917dfb9f
commit 73ecea242e

View File

@ -19,9 +19,7 @@ class GetBlocksView(APIView):
profiles = []
blocks = BlockModel.objects.filter(blocker=ProfileModel.objects.filter(user=request.user).first())
for block in blocks:
profile = ProfileModel.objects.filter(user=block.blocked)
if (profile.exists()):
profiles.append(profile[0])
profiles.append(block.blocked)
return Response(ProfileSerializer(profiles, many=True).data)