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.12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89935241866ce8d8931e1c2aee91b1c7f07b8a723ee535fa331fcc01b7fc429d |
|
MD5 | 7bfc3765f6e5998643e476051dda53b4 |
|
BLAKE2b-256 | 1343c0e089661a25dfd4cea8cc1479877772048777637d06f240e2eb70e7a03f |
Close
Hashes for django_auto_modeladmin-0.1.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b82468d26bc062c7055a24357e7ce14ce7c7ea8295b0fe21dd9d3acf8d233dcb |
|
MD5 | 97ccb64674b9d74452774dd6a4d155bc |
|
BLAKE2b-256 | e68a5d3a7424b24464cc09b0c04d7a6fb45dc54a7663e9e9e29d5f48ce990e6e |