Skip to main content

Django Admin Autogen

Dynamically register all fields of a model or all models in an app, in Django Admin.

Installation

pip install django_admin_autogen

Usage

Import

from django_admin_autogen.autogen.admin import register_all_fields_of_model
from django_admin_autogen.autogen.admin import register_all_models_of_app

register_all_fields_of_model

All fields included

register_all_models_of_app

Alt text

Register a model, with all fields included

from django_admin_autogen.autogen.admin import register_all_fields_of_model
# '<app_name>', <ModelName>
fast_part_note_class = register_all_fields_of_model('notebook', 'NoteCategory')

If your model admin requires using custom base class, you

# '<app_name>', <ModelName>, base_class=<YourCustomBaseClass>
fast_part_note_class = register_all_fields_of_model('outsource', 'Quotation', base_class=YourCustomBaseClass)

Override the default behavior by setting custom properties on the YourCustomBaseClass class.

# YourCustomBaseClass 
quotation.field_to_group_by = 'currency__name'
quotation.field_to_sum = 'total_price'

class Media:
    js = (
        'js/add_button.js',
    )

fast_part_note_class.Media = Media

Register all models in an app

Register all models of an app in Django Admin, with all of their fields included

from django_admin_autogen.autogen.admin import register_all_models_of_app

# <app_name>
register_all_models_of_app('outsource')

Metadata

Release files for django-admin-autogen 0.3.6

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-admin-autogen 0.3.6
File Size Uploaded
django-admin-autogen-0.3.6.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-admin-autogen 0.3.6
File Interpreter ABI Platform
django_admin_autogen-0.3.6-py3-none-any.whl Python 3 none any Details

Total release size: 5.7 kB

Release files / django-admin-autogen-0.3.6.tar.gz

Download URL django-admin-autogen-0.3.6.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
04226396da303a5083c2458a536c85c50852c0e6ed6626c12e72fec8443a2265
BLAKE2b-256 checksum
How to use checksums
6f2d51b08ba90825d6a68efad69fd9682cffc31ea8af446170719299ba7eaf95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / django_admin_autogen-0.3.6-py3-none-any.whl

Download URL django_admin_autogen-0.3.6-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4cf0172549a2ffe8c6d38f04bd8f1628851192490759c929f9fc702769174dd
BLAKE2b-256 checksum
How to use checksums
ec1a38559f0b0de8d0d067bf5740997178c8d5c339afaa4d796fb0bc7ea2c9f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.3.6 This release

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2

2 release files

0.1

2 release files

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