blocks: List comprehension for retrieving profiles
This commit is contained in:
parent
73ecea242e
commit
14886c8ac9
@ -16,12 +16,10 @@ class GetBlocksView(APIView):
|
||||
authentication_classes = (SessionAuthentication,)
|
||||
|
||||
def get(self, request: Request):
|
||||
profiles = []
|
||||
blocks = BlockModel.objects.filter(blocker=ProfileModel.objects.filter(user=request.user).first())
|
||||
for block in blocks:
|
||||
profiles.append(block.blocked)
|
||||
bloked_profiles = [block.blocked for block in blocks]
|
||||
|
||||
return Response(ProfileSerializer(profiles, many=True).data)
|
||||
return Response(ProfileSerializer(bloked_profiles, many=True).data)
|
||||
|
||||
|
||||
class EditBlocksView(APIView):
|
||||
|
Loading…
Reference in New Issue
Block a user