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 = []
|
profiles = []
|
||||||
blocks = BlockModel.objects.filter(blocker=ProfileModel.objects.filter(user=request.user).first())
|
blocks = BlockModel.objects.filter(blocker=ProfileModel.objects.filter(user=request.user).first())
|
||||||
for block in blocks:
|
for block in blocks:
|
||||||
profile = ProfileModel.objects.filter(user=block.blocked)
|
profiles.append(block.blocked)
|
||||||
if (profile.exists()):
|
|
||||||
profiles.append(profile[0])
|
|
||||||
|
|
||||||
return Response(ProfileSerializer(profiles, many=True).data)
|
return Response(ProfileSerializer(profiles, many=True).data)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user