Skip to main content

"cms.plugins.snippet" (from djangocms) cloned to extend it with some facilities

Project description

This is a “cms.plugins.snippet” (from djangocms) clone to extend it with some facilities

Original code is from the original DjangoCMS plugin.

Changes from original code

This clone try to change as few orignal code as possible, actually the differences are :

  • Adding a template tag to directly use snippet fragments in the templates, not only from CMS pages;

Requires

  • DjangoCMS version >= 2.3 (tested with 2.3.6) (should not work with >= 3.x);

Previously it required djangocms_text_ckeditor, but it has been deprecated, wyswyg is not really useful for snippet where we need to insert any valid HTML. Something more accurate like Codemirror should be used instead in the future.

Install

The only thing needed is to replace the cms.plugins.snippet in your DjangoCMS settings, like this :

INSTALLED_APPS = (
    'cms',
    # Plugins
    ...
    #'cms.plugins.snippet',
    'snippet', # the snippet plugin clone
    ...
)

Because the code is cloned from the original plugin with just a few changes, all CMS stuff should work as with the original plugin, you should even add it in an existing install without loss in database and without any syncdb.

Usage

Template tags

Use the template tags in your templates :

{% load snippet_tags %}
{% snippet_fragment [Snippet ID or instance] %}

Like this :

{% load snippet_tags %}
{% snippet_fragment 42 %}

The required argument is for the Snippet ID or a Snippet instance if you want.

Project details


Download files

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

Source Distribution

emencia-cms-snippet-2.3.6.3.2.tar.gz (8.7 kB view details)

Uploaded Source

File details

Details for the file emencia-cms-snippet-2.3.6.3.2.tar.gz.

File metadata

File hashes

Hashes for emencia-cms-snippet-2.3.6.3.2.tar.gz
Algorithm Hash digest
SHA256 45286dfb521010596c788f48debf5d8c6b0f1ffa82bbe6c4eeed88b462ccad32
MD5 b5bc960c5f82afa7f63414ca2d155838
BLAKE2b-256 2571cc4ef8d6afe675731640615ac51e95182facb21326571e7e8b4d6fa0dc42

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page