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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6af982fa02979353ec0d9b8f3d2b4c4cb74407ff3e2acf1caa7e53fa2d1044cd |
|
MD5 | 11feaa1f78d02e03625a661c9b2fced2 |
|
BLAKE2b-256 | cf19a485a76f28fbf5923849a3e1a72b7fc6082e2a071e26f48c4ef88abbc909 |
Close
Hashes for django_admin_autogen-0.3.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 237a79b96fcdc0a7f19b15672241018c981acbaa93aaf4cbb701ab08aefa63a5 |
|
MD5 | 6f72b0dbdae96c8f6a51dfecd57d5cf3 |
|
BLAKE2b-256 | f216e158a5af8d084681757f11c0d85fa5c822a6ea7af2da6dd1d0fcd8e17e6e |