Skip to main content

'Copy A Snippet' Feature for Wagtail CMS

You can now "copy" snippets (non-page models) in Wagtail CMS

Installation

  1. Install the python package wagtailsnippetscopy from pip

pip install wagtailsnippetscopy

Alternatively, you can install download or clone this repo and call pip install -e ..

  1. Add to INSTALLED_APPS in your settings.py:

'wagtailsnippetscopy',

  1. 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, {})
  1. 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):
  1. 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)
  1. 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wagtailsnippetscopy-0.5.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wagtailsnippetscopy-0.5.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file wagtailsnippetscopy-0.5.2.tar.gz.

File metadata

  • Download URL: wagtailsnippetscopy-0.5.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Darwin/22.4.0

File hashes

Hashes for wagtailsnippetscopy-0.5.2.tar.gz
Algorithm Hash digest
SHA256 9688e981c056b2c136c6166c3210c7d12dadd5d026957737bff036d1fee7b304
MD5 0f540c476833b58c83a9659ac4686035
BLAKE2b-256 ea02cf0c3dd909830d2c99455b0128a424f2e7822b39835d240ad17ee6eb6c29

See more details on using hashes here.

File details

Details for the file wagtailsnippetscopy-0.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for wagtailsnippetscopy-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 36b7554a68a3fca6c8ad56b829132cf49a3e98d51920a793b2c3f760e8c09bbf
MD5 bd232b425354f331a21908fc48f8727d
BLAKE2b-256 7cdf49b1f684d2d6e2f76aef5dd0521dc0fd53427bb2260be11f51e844f298f6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.2 This release

2 files

0.5.1

2 files

0.5.0

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page