django-tabbed-changeform-admin
Group fieldsets or inlinegroups into tabs for django admin's changeform.
Install
pip install django-tabbed-changeform-admin
Usgae
pro/settings.py
Note:
- We used jquery and jquery-ui's static files, so we MUST add django_static_jquery_ui in INSTALLED_APPS.
- We override admin/change_form.html, so we MUST add django_tabbed_changeform_admin in INSTALLED_APPS.
INSTALLED_APPS = [
....
'django_static_jquery_ui',
'django_tabbed_changeform_admin',
...
]
app/admin.py
Note:
- Create ModelAdmin based on DjangoTabbedChangeformAdmin.
- Add a sepcial class name to every fieldset or inline group.
- Add
tabsproperty to admin. It's a list of (Tab-Name, Content-Class-Names) pair. - You can get
tabsdynamically by overriding methodget_tabs(self, request, object_id, form_url, extra_context).
from django.contrib import admin
from django_tabbed_changeform_admin.admin import DjangoTabbedChangeformAdmin
from .models import Book
from .models import Character
class CharacterInline(admin.TabularInline):
model = Character
extra = 0
classes = ["tab-character-inline"]
class BookAdmin(DjangoTabbedChangeformAdmin, admin.ModelAdmin):
save_on_top = True
list_display = ["name", "published_time", "publisher"]
fieldsets = [
(None, {
"fields": ["name"],
"classes": ["tab-basic"],
}),
("Publish Information", {
"fields": ["published_time", "publisher"],
"classes": ["tab-publish-info"],
})
]
inlines = [
CharacterInline,
]
tabs = [
("Basic Information", ["tab-basic", "tab-publish-info"]),
("Characters", ["tab-character-inline"]),
]
admin.site.register(Book, BookAdmin)
Releases
v0.1.0 2020/03/17
- First releases.
v0.1.1 2020/03/18
- Set property tabs' default value to empty list.
tabs = []. - Use
django_tabbed_changeform_admin_tabsfor the context variable, so it will NOT conflict with other applications.
v0.1.2 2020/03/18
- Fix template problem while checking context variable
django_tabbed_changeform_admin_tabsexists or not.
v0.1.3 2020/03/21
- Do deep copy in
get_tabs, so that it will NOT chaos the originaltabssetting.
v0.1.4 2020/09/23
- Fix django_static_jquery3 upgrade problem.
- Add app_requires.
- Add LICENSE file.
v0.1.5 2020/09/23
- Remove django-static-jquery3 depends, using django vendor jquery.js instead.
- Tips: put your js between "admin/js/vendor/jquery/jquery.js" and "admin/js/jquery.init.js".
v0.1.6 2020/09/23
- doc fix.
v0.1.7 2023/09/15
- Doc update.
v0.1.8 2025/09/29
- 修正版本兼容性问题。
v0.1.9 2025/09/29
- 新增:切换标签时URL锚点,保存再编辑或保存失败时,仍然显示当前标签页。
Release files for django-tabbed-changeform-admin 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_tabbed_changeform_admin-0.1.9.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_tabbed_changeform_admin-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.8 kB
Release files / django_tabbed_changeform_admin-0.1.9.tar.gz
| Download URL | django_tabbed_changeform_admin-0.1.9.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
addc9c45f95da4bca23d510892d164bb89e72587e9acdf76126460a07121dc00
|
|
BLAKE2b-256 checksum How to use checksums |
207724911277b8b4f12dfeaa715dec01ff13449bb3f72fd94b37ecbda47aaa67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Release files / django_tabbed_changeform_admin-0.1.9-py3-none-any.whl
| Download URL | django_tabbed_changeform_admin-0.1.9-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4cff56a066527ae04621b287cfdcf7a39d8835f244e6cbda3f2e69157fe335ca
|
|
BLAKE2b-256 checksum How to use checksums |
dc37c62f683a280c1290d4505d69aec57dda63c374101188f0bb2a09c2b36956
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|