block: use of blocker instead of querying the db again
This commit is contained in:
parent
42917dfb9f
commit
73ecea242e
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user