Skip to main content

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

  1. 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

  1. list_display - A list of field names to use as the list_display.
  2. readonly_fields - A list of field names that should be read-only.
  3. exclude - A list of field names to exclude from the ModelAdmin.
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_auto_modeladmin-0.1.12.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

django_auto_modeladmin-0.1.12-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file django_auto_modeladmin-0.1.12.tar.gz.

File metadata

  • Download URL: django_auto_modeladmin-0.1.12.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for django_auto_modeladmin-0.1.12.tar.gz
Algorithm Hash digest
SHA256 89935241866ce8d8931e1c2aee91b1c7f07b8a723ee535fa331fcc01b7fc429d
MD5 7bfc3765f6e5998643e476051dda53b4
BLAKE2b-256 1343c0e089661a25dfd4cea8cc1479877772048777637d06f240e2eb70e7a03f

See more details on using hashes here.

File details

Details for the file django_auto_modeladmin-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: django_auto_modeladmin-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

File hashes

Hashes for django_auto_modeladmin-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 b82468d26bc062c7055a24357e7ce14ce7c7ea8295b0fe21dd9d3acf8d233dcb
MD5 97ccb64674b9d74452774dd6a4d155bc
BLAKE2b-256 e68a5d3a7424b24464cc09b0c04d7a6fb45dc54a7663e9e9e29d5f48ce990e6e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page