'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
Metadata
Release files for wagtailsnippetscopy 0.5.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 | |
|---|---|---|---|
| wagtailsnippetscopy-0.5.2.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wagtailsnippetscopy-0.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / wagtailsnippetscopy-0.5.2.tar.gz
| Download URL | wagtailsnippetscopy-0.5.2.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9688e981c056b2c136c6166c3210c7d12dadd5d026957737bff036d1fee7b304
|
|
BLAKE2b-256 checksum How to use checksums |
ea02cf0c3dd909830d2c99455b0128a424f2e7822b39835d240ad17ee6eb6c29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Darwin/22.4.0
|
Release files / wagtailsnippetscopy-0.5.2-py3-none-any.whl
| Download URL | wagtailsnippetscopy-0.5.2-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36b7554a68a3fca6c8ad56b829132cf49a3e98d51920a793b2c3f760e8c09bbf
|
|
BLAKE2b-256 checksum How to use checksums |
7cdf49b1f684d2d6e2f76aef5dd0521dc0fd53427bb2260be11f51e844f298f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Darwin/22.4.0
|