Skip to main content

The 'Django Admin Inline Paginator Plus' is simple way to paginate your inlines in Django admin

Project description

Django Admin Inline Paginator Plus ⏩

🍴 This is a forked and updated version based on original library django-admin-inline-paginator.

As for 10.07.2024 nobody took responsibility, so I decided to take it since we need additional functionlity like AJAX for pagination.

The "Django Admin Inline Paginator Plus" is simple way to paginate your inline in django admin

To keep Django ecosystem fresh and updated, please share your love and support, click Star 🫶

Features

  • Easy Inline Pagination: Quickly paginate inlines in the Django admin.
  • AJAX Support: Smooth and dynamic pagination without page reloads with htmx.
  • Multiple Inline Pagination: Manage multiple paginated inlines seamlessly.

Here's a screenshot of the paginated inlines in action:

Django Admin Inline Paginator Plus screenshot

Install:

Install the package via pip:

pip install django-admin-inline-paginator-plus

Usage:

  1. Add to your INSTALLED_APPS, in settings.py:

    INSTALLED_APPS = [
        ...
        'django_admin_inline_paginator_plus',
        ...
    ]
    
  2. Create your model inline:

    You can use TabularInlinePaginated ot StackedInlinePaginated. In our example we use TabularInlinePaginated.

    from django_admin_inline_paginator_plus.admin import TabularInlinePaginated
    
    class ModelWithFKAdminInline(TabularInlinePaginated):
        model = ModelWithFK
        fields = (...)
        per_page = 5
    
  3. Create main model admin and use inline:

    @register(YourModel)
    class YourModelAdmin(ModelAdmin):
        model = YourModel
        fields = (...)
        inlines = (ModelWithFKAdminInline, )
    

Advanced Usage:

  1. Paginate multiples inlines:

    from django_admin_inline_paginator_plus.admin import TabularInlinePaginated, StackedInlinePaginated
    
    class ModelWithFKInline(TabularInlinePaginated):
       model = ModelWithFK
       fields = ('name', 'active')
       per_page = 2
       pagination_key = 'page-model'  # make sure it's unique for page inline
    
    class AnotherModelWithFKInline(StackedInlinePaginated):
       model = AnotherModelWithFK
       fields = ('name', 'active')
       per_page = 2
       pagination_key = 'page-another-model'  # make sure it's unique for page inline
    
  2. Use inlines from step 1. and add to your main model admin:

    @register(YourModel)
    class YourModelAdmin(ModelAdmin):
        model = YourModel
        fields = (...)
        inlines = (ModelWithFKAdminInline, AnotherModelWithFKInline)
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_admin_inline_paginator_plus-0.1.5.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file django_admin_inline_paginator_plus-0.1.5.tar.gz.

File metadata

File hashes

Hashes for django_admin_inline_paginator_plus-0.1.5.tar.gz
Algorithm Hash digest
SHA256 8db247e50cd57ce41b071202eb4a4db23879574f436b60ca521a35aa3695877b
MD5 be88bd6484d4029ae7064932f9cafdc8
BLAKE2b-256 6df9e0c467e872e7ea9bf4840b7d06822f0b4da207b53dba540b9ba1ada6fcca

See more details on using hashes here.

File details

Details for the file django_admin_inline_paginator_plus-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_inline_paginator_plus-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8bc2b4123025a0dcde1f7f6d5d5372a44a593e29da0c6b4c6da8150057d26f76
MD5 014e85af08f37755ce72b05ac1a6c4b6
BLAKE2b-256 f6a25718875cafde0bad4dfdf814835e47446f1d7fefd75d82eb1cc2f86094bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page