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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8c99bf5535ffd7d4f80829dceff234e10f913b8ca284a34afa335d60b4b30cd |
|
MD5 | 3ac3157e8fdc3eabbfdc26381921d3ed |
|
BLAKE2b-256 | 1e6bfa47493ecfbaecef0ca32dacb8927e4f4d434930f3537c87f59a450e208f |
Close
Hashes for django_admin_autogen-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4af9c7d55708265a23143a0b715b8e5b1ce17b539b3c6b273a4bee3eb728cd37 |
|
MD5 | 05c4f6f5270d0e16e2a6d6f7e2a6e22e |
|
BLAKE2b-256 | 533e9f3d2d0dd869b3066fc3209148a577de48a2988475e24b315dc76117395e |