Copy A Snippet Feature for Wagtail CMS
Project description
'Copy A Snippet' Feature for Wagtail CMS
You can now "copy" snippets (non-page models) in Wagtail CMS
Installation
- Install the python package wagtailsnippetscopy from pip
pip install wagtailsnippetscopy
Alternatively, you can install download or clone this repo and call pip install -e .
.
- Add to INSTALLED_APPS in your settings.py:
'wagtailsnippetscopy',
- Register a model (with a title field name) you wish to enable copy functionality for:
from wagtailsnippetscopy.registry import snippet_copy_registry
snippet_copy_registry.register(YourModel, {})
- Add SnippetCopyMixin to your Snippet model in order to enable get_copy_url callback() for the model:
from wagtailsnippetscopy.models import SnippetCopyMixin
class Graph(SnippetCopyMixin, models.Model):
- If you wish copy link to automatically appear in modeladmin list you should add SnippetCopyModelAdminMixin to the ModelAdmin class:
In admin.py:
from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register
from wagtailsnippetscopy.admin import SnippetCopyModelAdminMixin
from .models import YourModel
class YourModelAdmin(SnippetCopyModelAdminMixin, ModelAdmin):
model = YourModel
modeladmin_register(GraphAdmin)
- Copy link follows the following pattern:
/admin/copy-snippet/<app_label>/<model_name>/<object_id>/
Bugs and suggestions
If you have found a bug or if you have a request for additional functionality, please use the issue tracker on GitHub.
https://github.com/timonweb/wagtailsnippetscopy/issues
by Tim Kamanin
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.
Source Distribution
Built Distribution
Close
Hashes for wagtailsnippetscopy-0.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bece6bbfa801878d9afd55c2e11654b3f70ea20a1f9f251994bf55d8a018c0dc |
|
MD5 | 4ec477b2c8aefb4bcfe1ab627326e23b |
|
BLAKE2b-256 | 9fca06a7b800cb0ccec26599bb6df80f146140fa8bf8d5a93a8f24f18b5614ad |
Close
Hashes for wagtailsnippetscopy-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87e7f183de8cf4668fd5e1cf80b97aad97718e9b12fc53d1b5d2fd6958e8ee36 |
|
MD5 | f3e7a341b401fe148bddd7aa4ead7392 |
|
BLAKE2b-256 | f5c25e8d1bf1a3a294893b59625e5d39f616bf5959b850e65538d7049efca59f |