pythondjangopaginationdjango-admindjango-pagination

How to paginate "Change List" page in Django admin?


With my admin.py below, all items are shown on only one Change List page in Django admin:

admin.py:

from cliente.models import Cliente
from django.contrib import admin

class ClienteAdmin(admin.ModelAdmin):
    list_display = ('nome','bairro','endereco','telefone')
    list_filter = ('bairro',)
    ordering = ('nome',)
    search_fields = ('endereco',)   
    pass

admin.site.register(Cliente,ClienteAdmin)

Now, I want to paginate Change List page to show the specific number of items on each Change List page. So, how can I do this?


Solution

  • See ModelAdmin.list_per_page. The default is 100, but you can set it to a lower value.