Wagtail CopyableModelAdmin
CopyableModelAdmin is an extension of the Wagtail ModelAdmin that allows for model instances to be copied in the user interface with a "Copy" button.
Dependencies
- Python 3.6+
- Django 1.11+, 2.0+
- Wagtail 1.13+, 2.0+
Installation
- Install wagtail-copyablemodeladmin:
pip install wagtail-copyablemodeladmin
- Add
copyablemodeladminas an installed app in your Djangosettings.py:
INSTALLED_APPS = (
...
'copyablemodeladmin',
...
)
Usage
Please see the Wagtail ModelAdmin documentation for getting started with ModelAdmin.
When creating a ModelAdmin for objects that should be copyable, instead of inheriting from ModelAdmin, inherit from copyablemodeladmin.options.CopyableModelAdmin:
from wagtail.contrib.modeladmin.options import modeladmin_register
from copyablemodeladmin.options import CopyableModelAdmin
from myapp.models import Book
# Inherit from CopyableModelAdmin instead of ModelAdmin
class BookAdmin(CopyableModelAdmin):
model = Book
list_display = ('title', 'author')
list_filter = ('author',)
search_fields = ('title', 'author')
# Now you just need to register your customised ModelAdmin class with Wagtail
modeladmin_register(BookAdmin)
In addition to CopyableModelAdmin, there are three mixin classes that can be added to other custom ModelAdmin subclasses:
from copyablemodeladmin.helpers import CopyButtonHelperMixin
from copyablemodeladmin.options import CopyableModelAdminMixin
from copyablemodeladmin.views import CopyViewMixin
class CustomCopyButtonHelper(CopyButtonHelperMixin, CustomButtonHelper):
pass
class CustomCopyInstanceView(CopyViewMixin, CustomInstanceSpecificView):
pass
class CustomCopyableModelAdmin(CopyableModelAdminMixin, ModelAdmin):
button_helper_class = CustomCopyButtonHelper
copy_view_class = CustomCopyInstanceView
Getting help
Please add issues to the issue tracker.
Getting involved
General instructions on how to contribute can be found in CONTRIBUTING.
Licensing
Credits and references
- Forked from cfgov-refresh
Metadata
Release files for wagtail-copyablemodeladmin 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wagtail-copyablemodeladmin-1.0.0.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wagtail_copyablemodeladmin-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.3 kB
Release files / wagtail-copyablemodeladmin-1.0.0.tar.gz
| Download URL | wagtail-copyablemodeladmin-1.0.0.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c98d235699ed08aefa1f6c23cecdc513c33c15277e115543531e09d5450a9d3
|
|
BLAKE2b-256 checksum How to use checksums |
dbec9946219cda51415ed54b47d63885248127665b43deccd3b7c43007f19d7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.9
|
Release files / wagtail_copyablemodeladmin-1.0.0-py3-none-any.whl
| Download URL | wagtail_copyablemodeladmin-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
afdc43e02bfd54b60655352e7d38f86ade9273fa30b939519eaffb4bcda8296e
|
|
BLAKE2b-256 checksum How to use checksums |
272fedf586ee150746d40ee0cd9b7eea74cf8903acf3c472bd15bcb61c803e27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.9
|