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
register_all_models_of_app
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
Built Distribution
Close
Hashes for django-admin-autogen-0.3.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b35ac5de85361140fee0e17a878b15e978fa33e851877f399b38fc5c6f0c725 |
|
MD5 | 0b0128091946d1556224bc6ba1c05efc |
|
BLAKE2b-256 | 98a01f232be6b00b551f5757931c17b7cb38442b1c25c1147d8531b2dcd1a105 |
Close
Hashes for django_admin_autogen-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c28f9838af24487b651398f087019dda93863ce820a93ee4c2b035049e5e2d2d |
|
MD5 | 102150bd8991e5955808b9f1f3a765b1 |
|
BLAKE2b-256 | 0b7bec457b4ca5590fceff0e54a960f63730105002f933c90f9c6418376fdad9 |