コード例 #1
0
ファイル: urls.py プロジェクト: dardevelin/NeuroVault
 def images(self, request, pk=None):
     collection = get_collection(pk,request,mode='api')
     queryset = Image.objects.filter(collection=collection)
     paginator = StandardResultPagination()
     page = paginator.paginate_queryset(queryset, request)
     serializer = ImageSerializer(page, context={'request': request}, many=True)
     return paginator.get_paginated_response(serializer.data)
コード例 #2
0
 def _get_paginated_results(self, obj_class, pk, request, serializer):
     collection = get_collection(pk, request, mode='api')
     queryset = obj_class.objects.filter(collection=collection)
     paginator = StandardResultPagination()
     page = paginator.paginate_queryset(queryset, request)
     serializer = serializer(page, context={'request': request}, many=True)
     return paginator.get_paginated_response(serializer.data)
コード例 #3
0
ファイル: views.py プロジェクト: vsoch/NeuroVault
 def _get_paginated_results(self, obj_class, pk, request, serializer):
     collection = get_collection(pk, request, mode='api')
     queryset = obj_class.objects.filter(collection=collection)
     paginator = StandardResultPagination()
     page = paginator.paginate_queryset(queryset, request)
     serializer = serializer(
         page, context={'request': request}, many=True)
     return paginator.get_paginated_response(serializer.data)
コード例 #4
0
 def images(self, request, pk=None):
     collection = get_collection(pk, request, mode='api')
     queryset = Image.objects.filter(collection=collection)
     paginator = StandardResultPagination()
     page = paginator.paginate_queryset(queryset, request)
     serializer = ImageSerializer(page,
                                  context={'request': request},
                                  many=True)
     return paginator.get_paginated_response(serializer.data)
コード例 #5
0
ファイル: views.py プロジェクト: MihirVaidya94/NeuroVault
    def images(self, request, pk=None):
        if request.method == 'POST':
            return self.add_item(request, pk, EditableStatisticMapSerializer)

        collection = get_collection(pk, request, mode='api')
        queryset = Image.objects.filter(collection=collection)
        paginator = StandardResultPagination()
        page = paginator.paginate_queryset(queryset, request)
        serializer = ImageSerializer(
            page, context={'request': request}, many=True)
        return paginator.get_paginated_response(serializer.data)
コード例 #6
0
    def images(self, request, pk=None):
        if request.method == 'POST':
            return self.add_item(request, pk, EditableStatisticMapSerializer)

        collection = get_collection(pk, request, mode='api')
        queryset = Image.objects.filter(collection=collection)
        paginator = StandardResultPagination()
        page = paginator.paginate_queryset(queryset, request)
        serializer = ImageSerializer(page,
                                     context={'request': request},
                                     many=True)
        return paginator.get_paginated_response(serializer.data)