(self, request, pk=None, format=None)
return Response(serializer.get_paginated_data())
Return a list of servers of a application
        which will be ordered by batch index if deployment is setted
        ---
        response_serializer: serializers.ServerSerializer
        parameters:
            - name: deployment
              description: >
                filter in servers of a application
                which involved in the given deployment
              type: integer
              paramType: query
Return a list of servers of a application
        which will be ordered by batch index if deployment is setted
        ---
        response_serializer: serializers.ServerSerializer
        parameters:
            - name: deployment
              description: >
                filter in servers of a application
                which involved in the given deployment
              type: integer
              paramType: query
Return a list of servers of a application which will be ordered by batch index if deployment is setted --- response_serializer : serializers . ServerSerializer parameters : - name : deployment description : > filter in servers of a application which involved in the given deployment type : integer paramType : query
def servers(self, request, pk=None, format=None):
        """
        Return a list of servers of a application
        which will be ordered by batch index if deployment is setted
        ---
        response_serializer: serializers.ServerSerializer
        parameters:
            - name: deployment
              description: >
                filter in servers of a application
                which involved in the given deployment
              type: integer
              paramType: query
        """
        from tars.server.models import Server

        app = self.get_object()
        deployment_id = request.QUERY_PARAMS.get('deployment')
        tgt_list = []

        if deployment_id is not None:
            deployment = get_object_or_404(app.deployments, pk=deployment_id)
            server_ids = deployment.targets.order_by('batch__index')\
                .values_list('server_id', flat=True)
            queryset = Server.objects.filter(id__in=server_ids)
        else:
            queryset = app.servers()

        serializer = serializers.ServerSerializer(
            queryset, many=True,
            context={'request': request, 'targets': tgt_list,
                     'hide_target': deployment_id is None})
        return Response(serializer.get_paginated_data())
def servers ( self , request , pk = None , format = None ) : from tars . server . models import Server app = self . get_object ( ) deployment_id = request . QUERY_PARAMS . get ( 'deployment' ) tgt_list = [ ] if deployment_id is not None : deployment = get_object_or_404 ( app . deployments , pk = deployment_id ) server_ids = deployment . targets . order_by ( 'batch__index' ) . values_list ( 'server_id' , flat = True ) queryset = Server . objects . filter ( id__in = server_ids ) else : queryset = app . servers ( ) serializer = serializers . ServerSerializer ( queryset , many = True , context = { 'request' : request , 'targets' : tgt_list , 'hide_target' : deployment_id is None } ) return Response ( serializer . get_paginated_data ( ) )