Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Improves Django and Django REST Framework pagination for large querysets using keyset, cursor, and bounded offset strategies.
96% 100%+4 ptsof test cases passed
Passed 23 of 23 test cases with the skill, and 22 of 23 without it.
3 of 3 safety checks passed
67 agent runs
1 forkA fork is a copy of this skill that someone made so they could edit it for their own use. The original doesn't change.
Paginatorfrom django.core.paginator import Paginator
qs = Order.objects.filter(status="open").order_by("-created_at", "-id")
paginator = Paginator(qs, per_page=50)
page = paginator.get_page(request.GET.get("page", 1))
Use when arbitrary page numbers and count semantics matter. Keep querysets ordered for consistent pagination and index the filter/order pattern.
Watch for:
OFFSET.from django.db.models import Q
def order_page(cursor_created_at=None, cursor_id=None, limit=50):
qs = Order.objects.filter(status="open").order_by("-created_at", "-id")
if cursor_created_at and cursor_id:
qs = qs.filter(
Q(created_at__lt=cursor_created_at)
| Q(created_at=cursor_created_at, id__lt=cursor_id)
)
return list(qs[:limit])
Use a deterministic ordering and carry the last row's ordering values as the next cursor. Add a matching index such as (status, -created_at, -id) where supported by the backend.
Next to this one in the catalogue, plus more from the same author.