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. 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'toINSTALLED_APPS, before'django.contrib.admin'. Order matters for template loading! - Add
'spurl'toINSTALLED_APPS. - Check that
'APP_DIRS'isTrueinTEMPLATESsettings.
Usage
Use the mixins for the model admins you want to have "readonly by default and edit by clicking button" mode:
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', )
Metadata
Release files for django-admin-edit-mode 0.1.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_admin_edit_mode-0.1.2.tar.gz | 15.9 kB | Without provenance | Details for django_admin_edit_mode-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_admin_edit_mode-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for django_admin_edit_mode-0.1.2-py3-none-any.whl |
Total release size: 34.3 kB
Release files / django_admin_edit_mode-0.1.2.tar.gz
| Download URL | django_admin_edit_mode-0.1.2.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f27bb83c08b4544af8667548a03458afeb1f256a4bf5011c2cba22c9ca5008fc
|
|
BLAKE2b-256 checksum How to use checksums |
446e0f3d9bef118080f2e29a13fe05eaf660e813f3140015204e6ff9cc8a3c22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.5 Darwin/21.6.0
|
Release files / django_admin_edit_mode-0.1.2-py3-none-any.whl
| Download URL | django_admin_edit_mode-0.1.2-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71a9050644b5ecc5a1fe2f8d4db4f6778a7a6b597748568f65b0a181494ca36f
|
|
BLAKE2b-256 checksum How to use checksums |
a5a52f80888a08c7a1bc4f2860107073f96305dcbe3521fbfbf806ea447f4dce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.5 Darwin/21.6.0
|
Security for django-admin-edit-mode 0.1.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.