Django Admin Inline Paginator Plus

raw JSON →
0.1.5 verified Fri May 01 auth: no python

Simple plugin to paginate Django admin inlines. Current version: 0.1.5, requires Python >=3.8. Active development, release cadence is irregular.

pip install django-admin-inline-paginator-plus
error No module named 'django_admin_inline_paginator_plus'
cause Import uses wrong module name; the correct module is `admin_inline_paginator`.
fix
Change import to from admin_inline_paginator import PaginatorInline.
error AttributeError: 'RelatedInline' object has no attribute 'per_page'
cause The `per_page` attribute is required but was not defined on the inline class.
fix
Add per_page = 10 (or your desired number) to the inline definition.
gotcha Import path: use `from admin_inline_paginator import PaginatorInline`, NOT `from django_admin_inline_paginator_plus import PaginatorInline`. The package name differs from the import module name.
fix Use `admin_inline_paginator` as the import module.
gotcha The `per_page` attribute must be set on the inline class; if omitted, the inline will not paginate (may default to showing all).
fix Always define `per_page = <int>` on your PaginatorInline subclass.
gotcha If you also use nested inlines (django-nested-inline), this package may conflict. Pagination and nested inlines together are not supported.
fix Do not use with nested inlines.

Create a PaginatorInline subclass and add it to your parent ModelAdmin. Set `per_page` to control how many items appear per page.

from django.contrib import admin
from myapp.models import RelatedModel, ParentModel
from admin_inline_paginator import PaginatorInline

class RelatedInline(PaginatorInline):
    model = RelatedModel
    per_page = 10

class ParentAdmin(admin.ModelAdmin):
    inlines = [RelatedInline]

admin.site.register(ParentModel, ParentAdmin)