pip install django-msms-admin
Intelligent management for multiple subclass models in django's admin site.
Install
pip install django-msms-admin
Installed Classes
-
DjangoMsmsModelAbstractBase
The base model must inherit from DjangoMsmsModelAbstractBase class. It provides app_label, model_name, type_name fields and auto save the values.
-
DjangoMsmsAdmin
The base model admin must inherit from DjangoMsmsAdmin class.
-
DjangoSubclassAdmin
All subclass models' admin must inherit from DjangoSubclassAdmin class.
Configurations
-
DjangoMsmsAdmin.subclasses
The config item is used to provide choices in select_subclass_model_view. If NOT provide, the system will auto find all registered subclasses. The structure of subclasses is a three-level-tree. e.g.
subclasses = [{ "title": "category1", "children": [{ "title": "category11", "children: [ Model1, Model2, Model3, ] },{ "title": "category12", "children": [ Model4, Model5, Model6, ] }] },{ "title": "category2", "children": [{ "title": "category21", "children": [ Model7, Model8, ] },{ "title": "category22, "children": [ Model9, ] }] }]
-
DjangoMsmsModelAbstractBase.cascade_select_description
-
DjangoMsmsModelAbstractBase.cascade_select_image
Config item cascade_select_description and cascade_select_image are use to display more information while you selected a subclass. cascade_select_image is url string of an image.
Usage
pro/settings.py
INSTALLED_APPS = [
...
'django_simple_tags',
'django_static_jquery3',
'django_msms_admin',
...
]
app/model.py
from django.db import models
from django.contrib.staticfiles.templatetags.staticfiles import static
from django_msms_admin.models import DjangoMsmsModelAbstractBase
class Book(DjangoMsmsModelAbstractBase, models.Model):
title = models.CharField(max_length=64)
author = models.CharField(max_length=64)
def __str__(self):
return self.title
class ComputerBook(Book):
serial = models.CharField(max_length=64)
cascade_select_description = "These books are all about computers."
cascade_select_image = static("app/img/computer-book.jpg")
class NovelBook(Book):
country = models.CharField(max_length=64)
app/admin.py
from django.contrib import admin
from django_msms_admin.admin import DjangoMsmsAdmin
from django_msms_admin.admin import DjangoSubclassAdmin
from .models import Book
from .models import ComputerBook
from .models import NovelBook
class BookAdmin(DjangoMsmsAdmin, admin.ModelAdmin):
list_display = ["title", "author", "type_name"]
list_filter = ["type_name"]
admin.site.register(Book, BookAdmin)
admin.site.register(ComputerBook, DjangoSubclassAdmin)
admin.site.register(NovelBook, DjangoSubclassAdmin)
Release
v0.1.0 2020/03/03
- First release.
v0.1.1 2020/03/05
- Add DjangoMsmsModelAbstractBase.get_real_object method.
v0.1.2 2020/03/06
- Fix keywords in setup.py and read requirements.txt for install_requires.
v0.2.0 2020/03/07
- Use model's msms_category, msm_priority property to do model category and sorting.
- Rename cascade_select_description to msms_description.
- Rename cascade_select_preview_image to msms_image.
v0.2.1 2020/09/09
- No depends on django-static-jquery3.
- Using media.css & media.js to render css/js links.
- Add LICENSE file.
v0.2.2 2023/09/18
- Doc update.
Metadata
Release files for django-msms-admin 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-msms-admin-0.2.2.tar.gz | 10.0 kB | Without provenance | Details for django-msms-admin-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_msms_admin-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for django_msms_admin-0.2.2-py3-none-any.whl |
Total release size: 20.8 kB
Release files / django-msms-admin-0.2.2.tar.gz
| Download URL | django-msms-admin-0.2.2.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ed11ee1ffb7d5b5b64461a3b8df5fddb93333f93feef6ae038f4dc286d39048
|
|
BLAKE2b-256 checksum How to use checksums |
84f1f7ad84e8f7ec51eb051b0df05d84059c3dc6670bff4edd301dc45783a6b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / django_msms_admin-0.2.2-py3-none-any.whl
| Download URL | django_msms_admin-0.2.2-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96281ff8c4f5a34978e68056d076e98ef14673086f3c85bd50e6e66c585ad0f0
|
|
BLAKE2b-256 checksum How to use checksums |
a651c0858d2688ec016a7b28ac707efa11db011ba5234309766ecf4dd5ec8978
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Security for django-msms-admin 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.