Skip to main content

django-rest-framework-custom-paginations

Custom paginations for django rest framework

Compatibility

work with :
  • Python 2.7 / 3.4

  • Dango 1.6 / 1.7

  • Django Rest Framework 2.4 / 3.0 / 3.1 / 3.2 / 3.3

Installation

Install the package from pypi:

pip install djangorestframework-custom-paginations

Add the application in your django settings:

DJANGO_APPS = ('rest_framework_custom_paginations',)

Configure your rest framework for DRF >= 3.1:

REST_FRAMEWORK = {
    'DEFAULT_PAGINATION_CLASS': 'rest_framework_custom_paginations.classes.SporePagination',
}

or configure your rest framework for DRF < 3.1:

REST_FRAMEWORK = {
    'DEFAULT_PAGINATION_SERIALIZER_CLASS': 'rest_framework_custom_paginations.paginations.SporePaginationSerializer'
}

Usage

Add the following parameters in a ListAPIView :

class PersonList(generics.ListAPIView):
    """ list of person """
    ...
    paginate_by = 100
    paginate_by_param = 'page_size'
    max_paginate_by = 500

Example

Results of Spore Pagination :

{
    "count": 532,
    "next": "http://myurls/persons.json?structure=mystructure&page=3",
    "next_params": {
        "page": 3,
        "structure": "mystructure"
    },
    "num_pages": 6,
    "previous": "http://myurls/persons.json?structure=mystructure&page=1",
    "previous_params": {
        "page": 1,
        "structure": "mystructure"
    },
    "results": [
        ...
    ]
}

Metadata

Release files for djangorestframework-custom-paginations 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangorestframework-custom-paginations 1.2.2
File Size Uploaded Provenance Actions
djangorestframework-custom-paginations-1.2.2.tar.gz 11.3 kB Without provenance Details for djangorestframework-custom-paginations-1.2.2.tar.gz

Release files / djangorestframework-custom-paginations-1.2.2.tar.gz

Download URL djangorestframework-custom-paginations-1.2.2.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
35d5189e36d050ccdfeafd5c68fd5b4ae2111b7f7c48f00fab204fc6b2b178af
BLAKE2b-256 checksum
How to use checksums
bb5c65b70c02bf0e4432af060d5ba29d19ff6ad6d3509dce199d4d1218f4b02d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for djangorestframework-custom-paginations 1.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page