Django Admin Inline Paginator

0.4.0 · maintenance · verified Sat Apr 11

The "Django Admin Inline Paginator" is a Python library designed to add pagination to inline forms within the Django administration interface. The latest version, 0.4.0, was released in April 2023. The original project is currently seeking maintainers, with development seemingly inactive, and a community-maintained fork (`django-admin-inline-paginator-plus`) has emerged to continue development and add new features.

Warnings

Install

Imports

Quickstart

To quickly integrate inline pagination, add `django_admin_inline_paginator` to your `INSTALLED_APPS`. Then, define your inline admin classes by inheriting from `TabularInlinePaginated` or `StackedInlinePaginated` and set the `per_page` attribute. Finally, include these paginated inlines in your main `ModelAdmin`.

from django.contrib import admin
from django.db import models

# Assuming you have a model named `YourModel` and another `ModelWithFK`
# linked by a ForeignKey from ModelWithFK to YourModel.
# Example Models:
# class YourModel(models.Model):
#     name = models.CharField(max_length=100)

# class ModelWithFK(models.Model):
#     your_model = models.ForeignKey(YourModel, on_delete=models.CASCADE)
#     name = models.CharField(max_length=100)

# 1. Add 'django_admin_inline_paginator' to INSTALLED_APPS in settings.py
# INSTALLED_APPS = [
#     ...,
#     'django_admin_inline_paginator',
#     ...
# ]

# 2. Create your model inline using TabularInlinePaginated
from django_admin_inline_paginator.admin import TabularInlinePaginated

class ModelWithFKAdminInline(TabularInlinePaginated):
    model = 'ModelWithFK' # Replace with your actual FK model
    fields = ('name',)
    per_page = 5 # Number of items per page
    # pagination_key = 'page-model' # Optional: required for multiple paginated inlines

# 3. Register your main model admin and use the inline
@admin.register('YourModel') # Replace with your actual main model
class YourModelAdmin(admin.ModelAdmin):
    model = 'YourModel'
    fields = ('name',)
    inlines = (ModelWithFKAdminInline,)

view raw JSON →