Automatically creates a ModelAdmin for each model instance passed in a list.
Project description
Django Auto ModelAdmin
Description
Automatically creates a ModelAdmin for each model instance passed in a list. Will also create an inline model for each related model.
Installation
pip install django-auto-modeladmin
or
pipenv install django-auto-modeladmin
Methods
- autoregister([ModelInstance/(ModelInstance, {options})]) - Allows for a tuple to be passed instead of a model instance, to allow for extra admin options like list_display, readonly_fields, etc.
Options
- list_display - A list of field names to use as the list_display.
- readonly_fields - A list of field names that should be read-only.
- exclude - A list of field names to exclude from the ModelAdmin.
- property_fields - A list of property names on the model that should be included.
Usage
from django_auto_modeladmin import autoregister
from . import models
autoregister([
(models.ModelName, {
"list_display": ["id", "name"],
"readonly_fields": ["id", "created_on", "modified_on"],
"exclude": ["uuid"],
"property_fields": ["full_name"],
})
])
Project details
Release history Release notifications | RSS feed
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_auto_modeladmin-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e68135619bcf7a11b887f115e270e7b7283103db1f51719f542998a23e982573 |
|
MD5 | 7fa2d818535a9ae279451d0a3ab9f4f4 |
|
BLAKE2b-256 | f61c0f0a12019d33a4bc2d6372e4f28e27dd167028a58a217e93f5e75d49ec36 |
Close
Hashes for django_auto_modeladmin-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e98e363c97fa64ae747eb538a0f4dcae985b29b00e44427cf0231e9e99e9e96 |
|
MD5 | 5ed9e7357780c951248f0c3828d7fc19 |
|
BLAKE2b-256 | e748e85d3243c9ed90af933af5d3a40f7e4fee9bf4866e4efb8f842c9f5f03bb |