
Security News
CISA Kills Off RSS Feeds for KEVs and Cyber Alerts
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
rest-framework-pagination
Advanced tools
Django REST framework limit/offset pagination with multiple queryset support
This is django rest framework pagination based on LimitOffsetPagination with multiple queryset support
Install the package with pip:
.. code-block:: sh
$ pip install rest_framework_pagination
.. code-block:: python
from rest_framework.viewsets import GenericViewSet
from rest_framework.mixins import ListModelMixin
from rest_framework_pagination.pagination import MultiQuerysetPagination
class MainPageView(ListModelMixin, GenericViewSet):
serializer_class = serializers.MainPageSerializer
pagination_class = MultiQuerysetPagination
querysets = [models.Person.objects.all(),
models.Order.objects.all(),
models.Address.objects.all()]
def get_queryset(self):
return self.querysets
def paginate_querysets(self, querysets):
return self.paginator.paginate(querysets, self.request, view=self)
def list(self, request, *args, **kwargs):
page = self.paginate_querysets(self.get_queryset())
serializer = self.get_serializer_class()(page, many=True)
return self.get_paginated_response(serializer.data)
FAQs
Django REST framework limit/offset pagination with multiple queryset support
We found that rest-framework-pagination demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.