navigation
Python

How to customize pagination for django admin?

| | django , python

In this tutorial I will show how to customize pagination for django admin. Django admin already provides pagination by default. It shows 100 per page. Here I Just setting list_per_page=5. You can change this by adding the following line in admin.py file.

django admin pagination

PYTHON CODE:


from django.contrib import admin

from .models import *

class ProductAdmin(admin.ModelAdmin):
list_display = ('name', 'description')
list_per_page=5

admin.site.register(Product,ProductAdmin)

VIDEO GUIDE
: