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.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37a511894b1c0659e2c49e21f14a02f621a450d9bdc795930bf19824f4599e09 |
|
MD5 | bfed562c3ed6b5c0292505d90a926f8b |
|
BLAKE2b-256 | 10e747248dfef82478767e6424c660d5a2facdfdf05d6cb0241a7feb70e6dafb |
Close
Hashes for django_admin_autogen-0.3.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ceb2a4bdbd86086fa9417d82e64c825e3b4252a7d0dc7f279e09a2b8f910587 |
|
MD5 | c649dbcf43b6cc25d64e1c13ebffd4d0 |
|
BLAKE2b-256 | 31e617417b9646b358bcab25d031edfb2bc3b832687cf8496a92c94729205754 |