Copyable ModelAdmins for Django models used on Wagtail Sites
Project description
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
copyablemodeladmin
as 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size wagtail_copyablemodeladmin-1.0.0-py3-none-any.whl (10.9 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size wagtail-copyablemodeladmin-1.0.0.tar.gz (5.4 kB) | File type Source | Python version None | Upload date | Hashes View |
Hashes for wagtail_copyablemodeladmin-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | afdc43e02bfd54b60655352e7d38f86ade9273fa30b939519eaffb4bcda8296e |
|
MD5 | 91185edf823980c1bebceb0fc0bce66f |
|
BLAKE2-256 | 272fedf586ee150746d40ee0cd9b7eea74cf8903acf3c472bd15bcb61c803e27 |
Hashes for wagtail-copyablemodeladmin-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c98d235699ed08aefa1f6c23cecdc513c33c15277e115543531e09d5450a9d3 |
|
MD5 | 263a2c02b983377c78e52c653d19c5b2 |
|
BLAKE2-256 | dbec9946219cda51415ed54b47d63885248127665b43deccd3b7c43007f19d7a |