Skip to main content

Django Admin Generator is a management command to automatically generate a Django `admin.py` file for given apps/models.

Project description

Django Admin Generator

CI PyPI version Python versions Documentation Status

The Django Admin Generator is a project which can automatically generate (scaffold) a Django Admin for you. By doing this it will introspect your models and automatically generate an Admin with properties like:

  • list_display for all local fields
  • list_filter for foreign keys with few items
  • raw_id_fields for foreign keys with a lot of items
  • search_fields for name and slug fields
  • prepopulated_fields for slug fields
  • date_hierarchy for created_at, updated_at or joined_at fields

Links

Install

  1. Install the package:

    pip install django-admin-generator
    
  2. Add django_admin_generator to your INSTALLED_APPS.

Usage

To generate an admin for a given app:

./manage.py admin_generator APP_NAME >> APP_NAME/admin.py

To generate an admin for a given app with all models starting with user:

./manage.py admin_generator APP_NAME '^user' >> APP_NAME/admin.py

To write the generated admin directly to each app's admin.py:

./manage.py admin_generator APP_NAME --write

Use all as the app name to generate admins for every local (i.e. not in site-packages) app:

./manage.py admin_generator all

Live demo

A self-documenting blog demo whose admin.py is fully auto-generated:

uv run --extra demo python test_project/manage.py demo   # or: tox -e demo

Then open http://127.0.0.1:8000/admin/ and log in with admin / admin. The admin index explains what was generated and why. See test_project/README.md for a guided tour.

Development

This project uses uv and tox:

uv sync --extra dev          # create the environment
uv run pytest                # run the tests
uv run ruff check .          # lint
uv run tox                   # full matrix (tests, lint, types, docs)

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_generator-3.0.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

django_admin_generator-3.0.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file django_admin_generator-3.0.0.tar.gz.

File metadata

  • Download URL: django_admin_generator-3.0.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_admin_generator-3.0.0.tar.gz
Algorithm Hash digest
SHA256 1b8ac607f6623a4bcf9b3e618d108c7d5152e86fb3df55683b0ab29953ba73d2
MD5 708942fa0da669a1c936358f105d5aa6
BLAKE2b-256 99dfbaaa52650de06818ca694ef0ad08d92edbcf2e1bbc8e77072123416cb73b

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_admin_generator-3.0.0.tar.gz:

Publisher: publish.yml on wolph/django-admin-generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_admin_generator-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_generator-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c598341e2beebe3448c1686a4897e8ef1837013925986f7b15dfb9279156447f
MD5 41334a17ac5afe063ccd214fb3edf4c8
BLAKE2b-256 8602c0c0dd2134c5db4a8e456c8ecf372a051b1cb96404e583525227361cc3ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_admin_generator-3.0.0-py3-none-any.whl:

Publisher: publish.yml on wolph/django-admin-generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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