Last modified: Jan 10, 2023 By Alexander Williams
How to add a custom pagination in Django Admin interface
By default, Django set 100 records per page in admin interface.
In this tutorial, I will show you how to control your models' pagination.
Custom Django admin pagination
First of all, let's see the model that we want to paginate.
As you can see, we've here 10 records, and we want to show 5 records per page.
To do this, we'll use list_per_page in the admin.py file:
from django.contrib import admin
#models
from .models import Topic
@admin.register(Topic)
class TopicAdmin(admin.ModelAdmin):
list_per_page = 5
Result: