Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/private/deposit_list.py
# Copyright (C) 2018-2020 The Software Heritage developers | # Copyright (C) 2018-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from rest_framework.fields import _UnvalidatedField | from rest_framework.fields import _UnvalidatedField | ||||
from rest_framework.generics import ListAPIView | from rest_framework.generics import ListAPIView | ||||
from rest_framework.pagination import PageNumberPagination | from rest_framework.pagination import PageNumberPagination | ||||
from rest_framework import serializers | from rest_framework import serializers | ||||
from . import SWHPrivateAPIView | from . import APIPrivateView | ||||
from ..converters import convert_status_detail | from ..converters import convert_status_detail | ||||
from ...models import Deposit | from ...models import Deposit | ||||
class DefaultPagination(PageNumberPagination): | class DefaultPagination(PageNumberPagination): | ||||
page_size = 100 | page_size = 100 | ||||
page_size_query_param = "page_size" | page_size_query_param = "page_size" | ||||
Show All 12 Lines | |||||
class DepositSerializer(serializers.ModelSerializer): | class DepositSerializer(serializers.ModelSerializer): | ||||
status_detail = StatusDetailField() | status_detail = StatusDetailField() | ||||
class Meta: | class Meta: | ||||
model = Deposit | model = Deposit | ||||
fields = "__all__" | fields = "__all__" | ||||
class DepositList(ListAPIView, SWHPrivateAPIView): | class APIList(ListAPIView, APIPrivateView): | ||||
"""Deposit request class to list the deposit's status per page. | """Deposit request class to list the deposit's status per page. | ||||
HTTP verbs supported: GET | HTTP verbs supported: GET | ||||
""" | """ | ||||
serializer_class = DepositSerializer | serializer_class = DepositSerializer | ||||
pagination_class = DefaultPagination | pagination_class = DefaultPagination | ||||
Show All 17 Lines |