Skip to main content

A Django package to dynamically create admin classes. Including all fields in a model, or all models in an app.

Project description

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')

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-autogen-0.3.6.tar.gz (2.7 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_autogen-0.3.6-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file django-admin-autogen-0.3.6.tar.gz.

File metadata

  • Download URL: django-admin-autogen-0.3.6.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for django-admin-autogen-0.3.6.tar.gz
Algorithm Hash digest
SHA256 04226396da303a5083c2458a536c85c50852c0e6ed6626c12e72fec8443a2265
MD5 d29cbec9f8a9df0737b078a3f05a4fdd
BLAKE2b-256 6f2d51b08ba90825d6a68efad69fd9682cffc31ea8af446170719299ba7eaf95

See more details on using hashes here.

File details

Details for the file django_admin_autogen-0.3.6-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_autogen-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a4cf0172549a2ffe8c6d38f04bd8f1628851192490759c929f9fc702769174dd
MD5 6f22ee3106a5c1146ee750ecd19773b5
BLAKE2b-256 ec1a38559f0b0de8d0d067bf5740997178c8d5c339afaa4d796fb0bc7ea2c9f7

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