Skip to main content

django-subadmin

django-subadmin lets a ModelAdmin live under another ModelAdmin. When related objects have outgrown an inline, a SubAdmin gives them their own list and change pages, with search, filters, and pagination scoped to a parent object. Subadmins can be nested several levels deep.

Compatibility

django-subadmin Django Python
6.1.x 6.1+ 3.12+
5.2.x 5.2, 6.0 3.10+
3.2.x 3.2, 4.x, 5.x 3.6+

The package version follows the oldest Django version supported by that line. Projects staying on Django 5.2 or 6.0 should constrain django-subadmin to >=5.2,<6.1.

Installation

pip install django-subadmin

Add subadmin to INSTALLED_APPS so Django can find its templates:

INSTALLED_APPS = [
    # Django's contrib apps and your own apps...
    "subadmin",
]

Example

The test app has a Parent model with related Child objects. Django's inline admin would put the children on the parent's form; a SubAdmin gives each parent its own child changelist instead.

# models.py
from django.db import models


class Parent(models.Model):
    name = models.CharField(max_length=100)


class Child(models.Model):
    parent = models.ForeignKey(Parent, on_delete=models.CASCADE)
    name = models.CharField(max_length=100)
# admin.py
from django.contrib import admin
from subadmin import RootSubAdmin, SubAdmin

from .models import Child, Parent


class ChildAdmin(SubAdmin):
    model = Child


@admin.register(Parent)
class ParentAdmin(RootSubAdmin):
    subadmins = (ChildAdmin,)

Open a parent in the admin and follow the link to its child admin. The child pages show only records for that parent. The parent foreign key is set automatically when adding a child and omitted from the nested form.

The test app models and admin configuration also show deeper nesting. Their workflows are covered by integration tests, which you can run from a source checkout with:

python -m django test tests --settings=tests.settings

Screenshots

The parent change page links to its child admin.

Parent change page with a Children link

The child changelist contains only that parent's children.

Child changelist scoped to Example parent

The child add form omits the parent foreign key, which is set automatically.

Child add form without a parent field

Labels

Set subadmin_label to change a subadmin link and its collection breadcrumbs without renaming the model:

class ChildAdmin(SubAdmin):
    model = Child
    subadmin_label = "Members"

The default is the model's verbose_name_plural. Object breadcrumbs and other model names keep their usual Django wording. Override get_subadmin_label(request) if the label needs to vary by request.

Upgrading from 3.2

Parent objects are now loaded through the parent admin's get_object() method, so custom get_queryset() filters affect nested pages. Each parent in the URL must also pass that admin's has_view_or_change_permission(request, obj) check. A parent hidden by the queryset returns 404; a visible parent without permission returns 403. Child permissions alone no longer grant access through a parent.

If you need the previous direct model lookup while adapting a project, set:

SUBADMIN_USE_DIRECT_PARENT_LOOKUP = True

This changes how parents are loaded, but does not skip the parent permission check.

Custom overrides of get_parent_instance() and get_subadmin_helper() need to accept request as their first argument after self. Their signatures are now get_parent_instance(self, request, parent_id) and get_subadmin_helper(self, request, view_args, object_id=None).

SubAdmin wraps forms to validate parent-scoped fields. If you override get_form() or get_changelist_form(), call super() so that wrapping still runs.

Metadata

Release files for django-subadmin 6.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-subadmin 6.1.0
File Size Uploaded
django_subadmin-6.1.0.tar.gz 141.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-subadmin 6.1.0
File Interpreter ABI Platform
django_subadmin-6.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 157.4 kB

Release files / django_subadmin-6.1.0.tar.gz

Download URL django_subadmin-6.1.0.tar.gz
Size 141.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4eb5d44ad8297ca41706b670585e809a0c0c3b82a3d446d34f3238f9ea6ae82a
BLAKE2b-256 checksum
How to use checksums
9826c8744e85f2fee78d11bfe4f869ffc5bfaca5af388dd676084caaab86048d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / django_subadmin-6.1.0-py3-none-any.whl

Download URL django_subadmin-6.1.0-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff266afb1e980c51f4479fd2c28df2a1fa808436bbb4c7c8fa5696a3190a5539
BLAKE2b-256 checksum
How to use checksums
be9669b3b250e572205a45196e1f9b08caa31cab3cb5c8aa1764db24b6617da7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

6.1.1

2 release files

This release

6.1.0 This release

2 release files

5.2.1

2 release files

5.2.0

2 release files

3.2.4

2 release files

3.2.3

2 release files

3.2.2

2 release files

3.2.1

2 release files

3.2.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.9.3

2 release files

1.9.2

1 release file

1.9.1

1 release file

1.9.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page