Skip to main content

response pagination using django restframework

Project description

example:

class TestAPI(APIView):

    @staticmethod
    def get(request):
        tests = Test.objects.all() # filter or order by or anything else
        
        pagination = PaginationObject(objects=tests, page=1, numbers_in_page=10, 
                     serializer=TestSerializer)

        return Response(pagination.serializer_data(), status=status.HTTP_200_OK)

to get all objects in one page :

        pagination = PaginationObject(objects=tests, page=1, numbers_in_page=-1, 
                     serializer=TestSerializer)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djangorestframework_pagination-1.2.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file djangorestframework_pagination-1.2.tar.gz.

File metadata

File hashes

Hashes for djangorestframework_pagination-1.2.tar.gz
Algorithm Hash digest
SHA256 e3f1b4a2b3185a6615ce164238e6f1a2d5e54991b653e1a534d4f1609e262947
MD5 0d2665982ea59879a852fa18f81ec779
BLAKE2b-256 16bb020e227dec54e612418698bfae48aee8b66fab414d616047cfb7d325362f

See more details on using hashes here.

File details

Details for the file djangorestframework_pagination-1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for djangorestframework_pagination-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b286067b7972e6249301b08b370412d03531f374899fef207e46b220fbb54a93
MD5 4b4a5cb175a8664a43af6afbd15c56b4
BLAKE2b-256 73808583c112c8b99437845d4c22c7378ce03cc0d159085162c57498a1e6da82

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page