"cms.plugins.snippet" (from djangocms) cloned to extend it with some facilities
Project description
This is a “cms.plugins.snippet” (from djangocms) cloned 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;
Add usage of djangocodemirror for the HTML editor;
Requires
DjangoCMS version >= 2.3 (tested with 2.3.6) (should not work with >= 3.x);
djangocodemirror 0.9.x;
In the admin, the HTML content will be edited with the djangocodemirror editor.
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 'djangocodemirror', # the editor ... )
Then add :
CODEMIRROR_SETTINGS = { 'cms_snippet': { 'mode': {'name': "jinja2", 'htmlMode': True}, 'lineWrapping': True, 'lineNumbers': True, 'search_enabled': True, 'embed_settings': True, 'add_jquery': True, 'lib_buttons_path': 'djangocodemirror/snippet_buttons.js', }, }
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
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
File details
Details for the file emencia-cms-snippet-2.3.7.tar.gz
.
File metadata
- Download URL: emencia-cms-snippet-2.3.7.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 697c65e5c0564e10a99ac191f5d10d0dd809a2059c997d47e8bc0cb9d0c3b7a8 |
|
MD5 | 10f87cfe253bbcd4af7850882c051b9e |
|
BLAKE2b-256 | 76ab2b8bf2086ddd111ddcb1dbf05d8912524011ac9d53f81e6168723c09257e |