django-admin-edit-mode


Namedjango-admin-edit-mode JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/mihasK/django-admin-edit-mode
SummaryProvides a possibility to open objects in django-admin in read-only mode by default, with a special button "Go to edit mode" to open the same change-object page in regular editable mode.
upload_time2023-09-01 15:20:07
maintainer
docs_urlNone
authorYour Name
requires_python>=3,<4
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-admin-edit-mode
[![PyPI - Version](https://img.shields.io/pypi/v/django-admin-edit-mode?label=django-admin-edit-mode&link=https%3A%2F%2Fpypi.org%2Fproject%2Fdjango-admin-edit-mode%2F)](https://pypi.org/project/django-admin-edit-mode/)

Allows to open django admin in read-only mode by default,
with a special button "Go to edit mode" to open the same change-object page in regular editable mode.

Why read-only mode by default is needed ? For some applications, django-admin serves mostly for reading the info.
**Readonly mode page looks better (cleaner)**, doesn't allow to make some changes accidentially, and the **page loads quicker** (e.g., no need to load a list of choices for the fields).
But you're not going to make admin completely readonly (e.g., by persmissions), because **sometimes you still want to change** the object.
Then you can **go to edit mode by clicking the button**!

Even more suitable edit mode could be on a list page.
For quick multi-object editing you would like to enable changing of some fields on list page 
with help of [`list_editable`](https://docs.djangoproject.com/en/4.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_editable). But it will alsways shows you edit mode on list page,
which looks not good (for most times you don't want to change, only look).
This libary provides you with buttons "Go Edit Mode" / "Go Readonly Mode".
Important note: your editable field should not serve as a link to the object, i.e., should not be in `list_display_links` or be the first field of `list_display` (the same restriction applies to regular Django's `list_editable`).

## Installation

* `pip install django-admin-edit-mode`
* Add `'django_admin_edit_mode'` to `INSTALLED_APPS`, **before `'django.contrib.admin'`**. Order matters for template loading!
* Add `'spurl'` to `INSTALLED_APPS`.
* Check that `'APP_DIRS'` is `True` in `TEMPLATES` settings.


## Usage

Use the mixins for the model admins you want to have "readonly by default and edit by clicking button" mode:

```python
import django_admin_edit_mode.admin


# Conditional edit mode enabled on edit object page
@admin.register(models.Book)
class BookAdmin(django_admin_edit_mode.admin.EditModeAdminMixin,
                      admin.ModelAdmin):
    ...

# Conditional edit mode enabled on list page
@admin.register(models.Author)
class AuthorAdmin(django_admin_edit_mode.admin.ConditionalListEditableAdminMixin,
                      admin.ModelAdmin):
    ...

    list_display = ('id', 'name', 'description', 'num_books')

    # list_editable = ('list_editable', )  # This you would use for "constant" edit mode
    conditional_list_editable = ('list_editable', ) 
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mihasK/django-admin-edit-mode",
    "name": "django-admin-edit-mode",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3,<4",
    "maintainer_email": "",
    "keywords": "",
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/44/6e/0f3d9bef118080f2e29a13fe05eaf660e813f3140015204e6ff9cc8a3c22/django_admin_edit_mode-0.1.2.tar.gz",
    "platform": null,
    "description": "# django-admin-edit-mode\n[![PyPI - Version](https://img.shields.io/pypi/v/django-admin-edit-mode?label=django-admin-edit-mode&link=https%3A%2F%2Fpypi.org%2Fproject%2Fdjango-admin-edit-mode%2F)](https://pypi.org/project/django-admin-edit-mode/)\n\nAllows to open django admin in read-only mode by default,\nwith a special button \"Go to edit mode\" to open the same change-object page in regular editable mode.\n\nWhy read-only mode by default is needed ? For some applications, django-admin serves mostly for reading the info.\n**Readonly mode page looks better (cleaner)**, doesn't allow to make some changes accidentially, and the **page loads quicker** (e.g., no need to load a list of choices for the fields).\nBut you're not going to make admin completely readonly (e.g., by persmissions), because **sometimes you still want to change** the object.\nThen you can **go to edit mode by clicking the button**!\n\nEven more suitable edit mode could be on a list page.\nFor quick multi-object editing you would like to enable changing of some fields on list page \nwith help of [`list_editable`](https://docs.djangoproject.com/en/4.2/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_editable). But it will alsways shows you edit mode on list page,\nwhich looks not good (for most times you don't want to change, only look).\nThis libary provides you with buttons \"Go Edit Mode\" / \"Go Readonly Mode\".\nImportant note: your editable field should not serve as a link to the object, i.e., should not be in `list_display_links` or be the first field of `list_display` (the same restriction applies to regular Django's `list_editable`).\n\n## Installation\n\n* `pip install django-admin-edit-mode`\n* Add `'django_admin_edit_mode'` to `INSTALLED_APPS`, **before `'django.contrib.admin'`**. Order matters for template loading!\n* Add `'spurl'` to `INSTALLED_APPS`.\n* Check that `'APP_DIRS'` is `True` in `TEMPLATES` settings.\n\n\n## Usage\n\nUse the mixins for the model admins you want to have \"readonly by default and edit by clicking button\" mode:\n\n```python\nimport django_admin_edit_mode.admin\n\n\n# Conditional edit mode enabled on edit object page\n@admin.register(models.Book)\nclass BookAdmin(django_admin_edit_mode.admin.EditModeAdminMixin,\n                      admin.ModelAdmin):\n    ...\n\n# Conditional edit mode enabled on list page\n@admin.register(models.Author)\nclass AuthorAdmin(django_admin_edit_mode.admin.ConditionalListEditableAdminMixin,\n                      admin.ModelAdmin):\n    ...\n\n    list_display = ('id', 'name', 'description', 'num_books')\n\n    # list_editable = ('list_editable', )  # This you would use for \"constant\" edit mode\n    conditional_list_editable = ('list_editable', ) \n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Provides a possibility to open objects in django-admin in read-only mode by default, with a special button \"Go to edit mode\" to open the same change-object page in regular editable mode.",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/mihasK/django-admin-edit-mode",
        "Repository": "https://github.com/mihasK/django-admin-edit-mode"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a5a52f80888a08c7a1bc4f2860107073f96305dcbe3521fbfbf806ea447f4dce",
                "md5": "c177e647c63a32e1a1dc31a0154e7778",
                "sha256": "71a9050644b5ecc5a1fe2f8d4db4f6778a7a6b597748568f65b0a181494ca36f"
            },
            "downloads": -1,
            "filename": "django_admin_edit_mode-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c177e647c63a32e1a1dc31a0154e7778",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3,<4",
            "size": 18434,
            "upload_time": "2023-09-01T15:20:04",
            "upload_time_iso_8601": "2023-09-01T15:20:04.236325Z",
            "url": "https://files.pythonhosted.org/packages/a5/a5/2f80888a08c7a1bc4f2860107073f96305dcbe3521fbfbf806ea447f4dce/django_admin_edit_mode-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "446e0f3d9bef118080f2e29a13fe05eaf660e813f3140015204e6ff9cc8a3c22",
                "md5": "1365a1b5a1c499ca78222fd01c17ec7f",
                "sha256": "f27bb83c08b4544af8667548a03458afeb1f256a4bf5011c2cba22c9ca5008fc"
            },
            "downloads": -1,
            "filename": "django_admin_edit_mode-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1365a1b5a1c499ca78222fd01c17ec7f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3,<4",
            "size": 15882,
            "upload_time": "2023-09-01T15:20:07",
            "upload_time_iso_8601": "2023-09-01T15:20:07.965641Z",
            "url": "https://files.pythonhosted.org/packages/44/6e/0f3d9bef118080f2e29a13fe05eaf660e813f3140015204e6ff9cc8a3c22/django_admin_edit_mode-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-01 15:20:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mihasK",
    "github_project": "django-admin-edit-mode",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-admin-edit-mode"
}
        
Elapsed time: 0.47644s