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
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. The 5.2 release drops support for Django before 5.2 and Python before 3.10.

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 5.2.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 5.2.0
File Size Uploaded
django_subadmin-5.2.0.tar.gz 140.4 kB Details

Built distribution (wheel)

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

Total release size: 156.4 kB

Release files / django_subadmin-5.2.0.tar.gz

Download URL django_subadmin-5.2.0.tar.gz
Size 140.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0ae44255a862dd66a6b4d611d81c5fb3d30bc4ddccc09492f5b7311b0f3d5df5
BLAKE2b-256 checksum
How to use checksums
f7a4e983c10fa0aaa46ee70cf18821099d277326ad34a0a282f2983884e9fa74
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-5.2.0-py3-none-any.whl

Download URL django_subadmin-5.2.0-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8882938c0a3a066861b49cd8328e2b1a330946a48797cd2b95bb18038fb3d533
BLAKE2b-256 checksum
How to use checksums
b69674acbecec4a67cb68435f1776696f7ef3c4233882d706bfae8d2bddd3e11
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

6.1.0

2 release files

5.2.1

2 release files

This release

5.2.0 This release

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