django-tabbed-changeform-admin


Namedjango-tabbed-changeform-admin JSON
Version 0.1.7 PyPI version JSON
download
home_page
SummaryGroup fieldsets or inlinegroups into tabs for django admin's changeform.
upload_time2023-09-15 07:35:23
maintainerChen JieChong
docs_urlNone
authorChen JieChong
requires_python
licenseMIT
keywords django admin extentions django tabbed changeform admin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-tabbed-changeform-admin

Group fieldsets or inlinegroups into tabs for django admin's changeform.

## Install

```shell
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.

```python
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 `tabs` property to admin. It's a list of (Tab-Name, Content-Class-Names) pair.
- You can get `tabs` dynamically by overriding method `get_tabs(self, request, object_id, form_url, extra_context)`.

```python
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_tabs` for 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_tabs` exists or not.

### v0.1.3 2020/03/21

- Do deep copy in `get_tabs`, so that it will NOT chaos the original `tabs` setting.

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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "django-tabbed-changeform-admin",
    "maintainer": "Chen JieChong",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "chenjiechong@zencore.cn",
    "keywords": "django admin extentions,django tabbed changeform admin",
    "author": "Chen JieChong",
    "author_email": "chenjiechong@zencore.cn",
    "download_url": "https://files.pythonhosted.org/packages/ba/0b/8a327eb321a52ea6558b4576da4831a9198de6c0cedb85fe07b3f02c6ac0/django-tabbed-changeform-admin-0.1.7.tar.gz",
    "platform": null,
    "description": "# django-tabbed-changeform-admin\n\nGroup fieldsets or inlinegroups into tabs for django admin's changeform.\n\n## Install\n\n```shell\npip install django-tabbed-changeform-admin\n```\n\n## Usgae\n\n**pro/settings.py**\n\n**Note:**\n\n- We used jquery and jquery-ui's static files, so we MUST add django_static_jquery_ui in INSTALLED_APPS.\n- We override admin/change_form.html, so we MUST add django_tabbed_changeform_admin in INSTALLED_APPS.\n\n```python\nINSTALLED_APPS = [\n    ....\n    'django_static_jquery_ui',\n    'django_tabbed_changeform_admin',\n    ...\n]\n```\n\n**app/admin.py**\n\n**Note:**\n\n- Create ModelAdmin based on DjangoTabbedChangeformAdmin.\n- Add *a sepcial class name* to every fieldset or inline group.\n- Add `tabs` property to admin. It's a list of (Tab-Name, Content-Class-Names) pair.\n- You can get `tabs` dynamically by overriding method `get_tabs(self, request, object_id, form_url, extra_context)`.\n\n```python\nfrom django.contrib import admin\nfrom django_tabbed_changeform_admin.admin import DjangoTabbedChangeformAdmin\nfrom .models import Book\nfrom .models import Character\n\n\nclass CharacterInline(admin.TabularInline):\n    model = Character\n    extra = 0\n    classes = [\"tab-character-inline\"]\n\nclass BookAdmin(DjangoTabbedChangeformAdmin, admin.ModelAdmin):\n    save_on_top = True\n    list_display = [\"name\", \"published_time\", \"publisher\"]\n    fieldsets = [\n        (None, {\n            \"fields\": [\"name\"],\n            \"classes\": [\"tab-basic\"],\n        }),\n        (\"Publish Information\", {\n            \"fields\": [\"published_time\", \"publisher\"],\n            \"classes\": [\"tab-publish-info\"],\n        })\n    ]\n    inlines = [\n        CharacterInline,\n    ]\n\n    tabs = [\n        (\"Basic Information\", [\"tab-basic\", \"tab-publish-info\"]),\n        (\"Characters\", [\"tab-character-inline\"]),\n    ]\n\nadmin.site.register(Book, BookAdmin)\n```\n\n## Releases\n\n\n\n\n### v0.1.0 2020/03/17\n\n- First releases.\n\n### v0.1.1 2020/03/18\n\n- Set property tabs' default value to empty list. `tabs = []`.\n- Use `django_tabbed_changeform_admin_tabs` for the context variable, so it will NOT conflict with other applications.\n\n### v0.1.2 2020/03/18\n\n- Fix template problem while checking context variable `django_tabbed_changeform_admin_tabs` exists or not.\n\n### v0.1.3 2020/03/21\n\n- Do deep copy in `get_tabs`, so that it will NOT chaos the original `tabs` setting.\n\n### v0.1.4 2020/09/23\n\n- Fix django_static_jquery3 upgrade problem.\n- Add app_requires.\n- Add LICENSE file.\n\n### v0.1.5 2020/09/23\n\n- Remove django-static-jquery3 depends, using django vendor jquery.js instead.\n    - Tips: put your js between \"admin/js/vendor/jquery/jquery.js\" and \"admin/js/jquery.init.js\".\n\n### v0.1.6 2020/09/23\n\n- doc fix.\n\n### v0.1.7 2023/09/15\n\n- Doc update.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Group fieldsets or inlinegroups into tabs for django admin's changeform.",
    "version": "0.1.7",
    "project_urls": null,
    "split_keywords": [
        "django admin extentions",
        "django tabbed changeform admin"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3c722ae24b112876c372ae5d0e24fb3828a7a74c2128ec8f9b35aef6e932077a",
                "md5": "9f56d5de443db5172bed132023366471",
                "sha256": "0ca033210bda8feb95ac9caea130dcfc4b5d844edb00fb79a5e5a21f5842ec42"
            },
            "downloads": -1,
            "filename": "django_tabbed_changeform_admin-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9f56d5de443db5172bed132023366471",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7096,
            "upload_time": "2023-09-15T07:35:21",
            "upload_time_iso_8601": "2023-09-15T07:35:21.070840Z",
            "url": "https://files.pythonhosted.org/packages/3c/72/2ae24b112876c372ae5d0e24fb3828a7a74c2128ec8f9b35aef6e932077a/django_tabbed_changeform_admin-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ba0b8a327eb321a52ea6558b4576da4831a9198de6c0cedb85fe07b3f02c6ac0",
                "md5": "e590586aefef7a249325a1f3f18dc2f5",
                "sha256": "3f706bc85d0ccc68cb069e9663e706ee271e903815b5bb95a167154c8a9287ab"
            },
            "downloads": -1,
            "filename": "django-tabbed-changeform-admin-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "e590586aefef7a249325a1f3f18dc2f5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6643,
            "upload_time": "2023-09-15T07:35:23",
            "upload_time_iso_8601": "2023-09-15T07:35:23.739660Z",
            "url": "https://files.pythonhosted.org/packages/ba/0b/8a327eb321a52ea6558b4576da4831a9198de6c0cedb85fe07b3f02c6ac0/django-tabbed-changeform-admin-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-15 07:35:23",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "django-tabbed-changeform-admin"
}
        
Elapsed time: 0.26483s