Skip to main content

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

  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

Project details


Download files

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

Files for wagtailsnippetscopy, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size wagtailsnippetscopy-0.2.0-py3-none-any.whl (6.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size wagtailsnippetscopy-0.2.0.tar.gz (4.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page