Name | djangocms-snippet JSON |
Version |
5.0.0
JSON |
| download |
home_page | None |
Summary | Adds snippet plugin to django CMS. |
upload_time | 2025-01-07 06:59:41 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | Copyright (c) 2011, Divio AG All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Divio AG nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIVIO AG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
asgiref
build
bump2version
cfgv
click
distlib
django
django-classy-tags
django-cms
django-formtools
django-sekizai
django-treebeard
djangocms-admin-style
filelock
identify
importlib-metadata
nodeenv
packaging
pip-tools
platformdirs
pre-commit
pyproject-hooks
pyyaml
sqlparse
tomli
typing-extensions
virtualenv
wheel
zipp
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
==================
django CMS Snippet
==================
|pypi| |coverage| |python| |django| |djangocms| |djangocms4|
**django CMS Snippet** provides a plugin for `django CMS <http://django-cms.org>`_
to inject HTML, CSS or JavaScript snippets into your website.
This project is endorsed by the `django CMS Association <https://www.django-cms.org/en/about-us/>`_. Join us on `Slack <https://www.django-cms.org/slack/>`_.
Warning: We recommend using this plugin only during development::
This plugin is a potential security hazard, since it allows authorized-
users to place custom markup or Javascript on pages bypassing all of
Django's normal sanitization mechanisms. This could be exploited by users
with the right to add snippets to elevate their privileges to superusers.
This plugin should only be used during the initial development phase for
rapid prototyping and testing.
.. image:: preview.gif
*******************************************
Contribute to this project and win rewards
*******************************************
Because this is a an open-source project, we welcome everyone to
`get involved in the project <https://www.django-cms.org/en/contribute/>`_ and
`receive a reward <https://www.django-cms.org/en/bounty-program/>`_ for their contribution.
Become part of a fantastic community and help us make django CMS the best CMS in the world.
We'll be delighted to receive your
feedback in the form of issues and pull requests. Before submitting your
pull request, please review our `contribution guidelines
<http://docs.django-cms.org/en/latest/contributing/index.html>`_.
We're grateful to all contributors who have helped create and maintain this package.
Contributors are listed at the `contributors <https://github.com/django-cms/djangocms-snippet/graphs/contributors>`_
section.
One of the easiest contributions you can make is helping to translate this addon on
`Transifex <https://www.transifex.com/projects/p/djangocms-snippet/>`_.
Documentation
=============
See ``REQUIREMENTS`` in the `setup.py <https://github.com/divio/djangocms-snippet/blob/master/setup.py>`_
file for additional dependencies.
Installation
------------
For a manual install:
* run ``pip install djangocms-snippet``
* add ``djangocms_snippet`` to your ``INSTALLED_APPS``
* run ``python manage.py migrate djangocms_snippet``
Djangocms-snippet uses the ace code editor which normally is loaded from a CDN.
If you prefer your application to provide the editor locally, you can change
the requirement from `djangocms_snippet` to `djangocms_snippet[static-ace]` and
add `djangocms_static_ace` to your project's `INSTALLED_APPS`.
Configuration
-------------
To allow the contents of all snippets to be searchable, please set
``DJANGOCMS_SNIPPET_SEARCH`` to ``True`` in your settings::
DJANGOCMS_SNIPPET_SEARCH = True
We are using `Ace <https://ace.c9.io/#nav=about>`_ as our editor of choice
to edit the snippet content. You can customize the
`theme <https://github.com/ajaxorg/ace/tree/master/lib/ace/theme>`_ and
`mode <https://github.com/ajaxorg/ace/tree/master/lib/ace/mode>`_ through::
DJANGOCMS_SNIPPET_THEME = 'github'
DJANGOCMS_SNIPPET_MODE = 'html'
If dynamic content is inserted (for example ``{% show_menu ... %}``), the plugin cache must be disabled,
please set ``DJANGOCMS_SNIPPET_CACHE`` to ``False`` in your settings::
DJANGOCMS_SNIPPET_CACHE = False # default value is False
Migration 0010 requires the use of a user in order to create versions for existing snippets (if djangocms_versioning is installed and enabled),
a user can be chosen with the setting ``DJANGOCMS_SNIPPET_VERSIONING_MIGRATION_USER_ID``, the default is 1.
This setting is also exposed as an Environment variable for Divio projects using the Divio addon.
DJANGOCMS_SNIPPET_VERSIONING_MIGRATION_USER_ID = 2 # Will use user with id: 2
Template tag
------------
You can also use a template tag to render a snippet rather than a plugin::
{% load snippet_tags %}
{% snippet_fragment [reference] %}
Replace ``[reference]`` with either:
* The snippet ID, e.g. ``{% snippet_fragment 42 %}``
* The snippet slug, e.g. ``{% snippet_fragment 'my-snippet' %}``
* The snippet instance, e.g. ``{% snippet_fragment instance.snippet %}``
Optionally provide a fallback if there is no matching id/slug/instance::
{% snippet_fragment 'my-snippet' or %}
... your content fallback here ...
{% endsnippet_fragment %}
Running Tests
-------------
You can run tests by executing::
virtualenv env
source env/bin/activate
pip install -r tests/requirements.txt
python setup.py test
.. |pypi| image:: https://badge.fury.io/py/djangocms-snippet.svg
:target: http://badge.fury.io/py/djangocms-snippet
.. |coverage| image:: https://codecov.io/gh/django-cms/djangocms-snippet/branch/master/graph/badge.svg
:target: https://codecov.io/gh/django-cms/djangocms-snippet
.. |python| image:: https://img.shields.io/badge/python-3.9+-blue.svg
:target: https://pypi.org/project/djangocms-snippet/
.. |django| image:: https://img.shields.io/badge/django-4.2+-blue.svg
:target: https://www.djangoproject.com/
.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-3.11-blue.svg
:target: https://www.django-cms.org/
.. |djangocms4| image:: https://img.shields.io/badge/django%20CMS-4%2B-blue.svg
:target: https://www.django-cms.org/
Raw data
{
"_id": null,
"home_page": null,
"name": "djangocms-snippet",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Django CMS Association and contributors <info@django-cms.org>",
"keywords": null,
"author": null,
"author_email": "Divio AG <info@divio.ch>",
"download_url": "https://files.pythonhosted.org/packages/1d/94/8d060ae2d3bd4d29742405c7f1e6a82b1974d3d1f83c91b640fe5b86abd6/djangocms_snippet-5.0.0.tar.gz",
"platform": null,
"description": "==================\ndjango CMS Snippet\n==================\n\n|pypi| |coverage| |python| |django| |djangocms| |djangocms4|\n\n\n**django CMS Snippet** provides a plugin for `django CMS <http://django-cms.org>`_\nto inject HTML, CSS or JavaScript snippets into your website.\n\nThis project is endorsed by the `django CMS Association <https://www.django-cms.org/en/about-us/>`_. Join us on `Slack <https://www.django-cms.org/slack/>`_.\n\n\n\nWarning: We recommend using this plugin only during development::\n\n This plugin is a potential security hazard, since it allows authorized-\n users to place custom markup or Javascript on pages bypassing all of\n Django's normal sanitization mechanisms. This could be exploited by users\n with the right to add snippets to elevate their privileges to superusers.\n This plugin should only be used during the initial development phase for\n rapid prototyping and testing.\n\n.. image:: preview.gif\n\n\n*******************************************\nContribute to this project and win rewards\n*******************************************\n\nBecause this is a an open-source project, we welcome everyone to\n`get involved in the project <https://www.django-cms.org/en/contribute/>`_ and\n`receive a reward <https://www.django-cms.org/en/bounty-program/>`_ for their contribution.\nBecome part of a fantastic community and help us make django CMS the best CMS in the world.\n\nWe'll be delighted to receive your\nfeedback in the form of issues and pull requests. Before submitting your\npull request, please review our `contribution guidelines\n<http://docs.django-cms.org/en/latest/contributing/index.html>`_.\n\nWe're grateful to all contributors who have helped create and maintain this package.\nContributors are listed at the `contributors <https://github.com/django-cms/djangocms-snippet/graphs/contributors>`_\nsection.\n\nOne of the easiest contributions you can make is helping to translate this addon on\n`Transifex <https://www.transifex.com/projects/p/djangocms-snippet/>`_.\n\n\nDocumentation\n=============\n\nSee ``REQUIREMENTS`` in the `setup.py <https://github.com/divio/djangocms-snippet/blob/master/setup.py>`_\nfile for additional dependencies.\n\n\nInstallation\n------------\n\nFor a manual install:\n\n* run ``pip install djangocms-snippet``\n* add ``djangocms_snippet`` to your ``INSTALLED_APPS``\n* run ``python manage.py migrate djangocms_snippet``\n\nDjangocms-snippet uses the ace code editor which normally is loaded from a CDN.\nIf you prefer your application to provide the editor locally, you can change\nthe requirement from `djangocms_snippet` to `djangocms_snippet[static-ace]` and\nadd `djangocms_static_ace` to your project's `INSTALLED_APPS`.\n\n\nConfiguration\n-------------\n\nTo allow the contents of all snippets to be searchable, please set\n``DJANGOCMS_SNIPPET_SEARCH`` to ``True`` in your settings::\n\n DJANGOCMS_SNIPPET_SEARCH = True\n\nWe are using `Ace <https://ace.c9.io/#nav=about>`_ as our editor of choice\nto edit the snippet content. You can customize the\n`theme <https://github.com/ajaxorg/ace/tree/master/lib/ace/theme>`_ and\n`mode <https://github.com/ajaxorg/ace/tree/master/lib/ace/mode>`_ through::\n\n DJANGOCMS_SNIPPET_THEME = 'github'\n DJANGOCMS_SNIPPET_MODE = 'html'\n\nIf dynamic content is inserted (for example ``{% show_menu ... %}``), the plugin cache must be disabled,\nplease set ``DJANGOCMS_SNIPPET_CACHE`` to ``False`` in your settings::\n\n DJANGOCMS_SNIPPET_CACHE = False # default value is False\n\nMigration 0010 requires the use of a user in order to create versions for existing snippets (if djangocms_versioning is installed and enabled),\na user can be chosen with the setting ``DJANGOCMS_SNIPPET_VERSIONING_MIGRATION_USER_ID``, the default is 1.\nThis setting is also exposed as an Environment variable for Divio projects using the Divio addon.\n\n DJANGOCMS_SNIPPET_VERSIONING_MIGRATION_USER_ID = 2 # Will use user with id: 2\n\nTemplate tag\n------------\n\nYou can also use a template tag to render a snippet rather than a plugin::\n\n {% load snippet_tags %}\n {% snippet_fragment [reference] %}\n\nReplace ``[reference]`` with either:\n\n* The snippet ID, e.g. ``{% snippet_fragment 42 %}``\n* The snippet slug, e.g. ``{% snippet_fragment 'my-snippet' %}``\n* The snippet instance, e.g. ``{% snippet_fragment instance.snippet %}``\n\nOptionally provide a fallback if there is no matching id/slug/instance::\n\n {% snippet_fragment 'my-snippet' or %}\n ... your content fallback here ...\n {% endsnippet_fragment %}\n\n\nRunning Tests\n-------------\n\nYou can run tests by executing::\n\n virtualenv env\n source env/bin/activate\n pip install -r tests/requirements.txt\n python setup.py test\n\n\n.. |pypi| image:: https://badge.fury.io/py/djangocms-snippet.svg\n :target: http://badge.fury.io/py/djangocms-snippet\n.. |coverage| image:: https://codecov.io/gh/django-cms/djangocms-snippet/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/django-cms/djangocms-snippet\n.. |python| image:: https://img.shields.io/badge/python-3.9+-blue.svg\n :target: https://pypi.org/project/djangocms-snippet/\n.. |django| image:: https://img.shields.io/badge/django-4.2+-blue.svg\n :target: https://www.djangoproject.com/\n.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-3.11-blue.svg\n :target: https://www.django-cms.org/\n.. |djangocms4| image:: https://img.shields.io/badge/django%20CMS-4%2B-blue.svg\n :target: https://www.django-cms.org/\n",
"bugtrack_url": null,
"license": "Copyright (c) 2011, Divio AG All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Divio AG nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIVIO AG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
"summary": "Adds snippet plugin to django CMS.",
"version": "5.0.0",
"project_urls": {
"Bug Tracker": "https://github.com/django-cms/djangocms-snippet/issues",
"Changelog": "https://github.com/django-cms/djangocms-snippet/blob/master/CHANGELOG.rst",
"Repository": "https://github.com/django-cms/djangocms-snippet",
"Support": "https://www.django-cms.org/slack/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e74bd72b01b6f0ba9985194d03cc81883621a82eef8066757d4836b7bdc9207e",
"md5": "fc0714478c621240271baad837f31d96",
"sha256": "fa37d65a8ddde1323bea306f11f718fb7ee67cd29467517312811600e7529840"
},
"downloads": -1,
"filename": "djangocms_snippet-5.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fc0714478c621240271baad837f31d96",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 150353,
"upload_time": "2025-01-07T06:59:38",
"upload_time_iso_8601": "2025-01-07T06:59:38.556612Z",
"url": "https://files.pythonhosted.org/packages/e7/4b/d72b01b6f0ba9985194d03cc81883621a82eef8066757d4836b7bdc9207e/djangocms_snippet-5.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1d948d060ae2d3bd4d29742405c7f1e6a82b1974d3d1f83c91b640fe5b86abd6",
"md5": "d7c3ee88bbc7cc569b47ac06d929eea0",
"sha256": "05d0882bd549b6be6fe0050ad0c0d7a2abf0847ba0cc150100a5f420e5fd3abf"
},
"downloads": -1,
"filename": "djangocms_snippet-5.0.0.tar.gz",
"has_sig": false,
"md5_digest": "d7c3ee88bbc7cc569b47ac06d929eea0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 42182,
"upload_time": "2025-01-07T06:59:41",
"upload_time_iso_8601": "2025-01-07T06:59:41.308943Z",
"url": "https://files.pythonhosted.org/packages/1d/94/8d060ae2d3bd4d29742405c7f1e6a82b1974d3d1f83c91b640fe5b86abd6/djangocms_snippet-5.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-07 06:59:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "django-cms",
"github_project": "djangocms-snippet",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "asgiref",
"specs": [
[
"==",
"3.8.1"
]
]
},
{
"name": "build",
"specs": [
[
"==",
"1.2.1"
]
]
},
{
"name": "bump2version",
"specs": [
[
"==",
"1.0.1"
]
]
},
{
"name": "cfgv",
"specs": [
[
"==",
"3.4.0"
]
]
},
{
"name": "click",
"specs": [
[
"==",
"8.1.7"
]
]
},
{
"name": "distlib",
"specs": [
[
"==",
"0.3.8"
]
]
},
{
"name": "django",
"specs": [
[
"==",
"4.2.13"
]
]
},
{
"name": "django-classy-tags",
"specs": [
[
"==",
"4.1.0"
]
]
},
{
"name": "django-cms",
"specs": [
[
"==",
"4.1.1"
]
]
},
{
"name": "django-formtools",
"specs": [
[
"==",
"2.5.1"
]
]
},
{
"name": "django-sekizai",
"specs": [
[
"==",
"4.1.0"
]
]
},
{
"name": "django-treebeard",
"specs": [
[
"==",
"4.7.1"
]
]
},
{
"name": "djangocms-admin-style",
"specs": [
[
"==",
"3.3.1"
]
]
},
{
"name": "filelock",
"specs": [
[
"==",
"3.14.0"
]
]
},
{
"name": "identify",
"specs": [
[
"==",
"2.5.36"
]
]
},
{
"name": "importlib-metadata",
"specs": [
[
"==",
"7.1.0"
]
]
},
{
"name": "nodeenv",
"specs": [
[
"==",
"1.8.0"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"24.0"
]
]
},
{
"name": "pip-tools",
"specs": [
[
"==",
"7.4.1"
]
]
},
{
"name": "platformdirs",
"specs": [
[
"==",
"4.2.2"
]
]
},
{
"name": "pre-commit",
"specs": [
[
"==",
"3.7.1"
]
]
},
{
"name": "pyproject-hooks",
"specs": [
[
"==",
"1.1.0"
]
]
},
{
"name": "pyyaml",
"specs": [
[
"==",
"6.0.1"
]
]
},
{
"name": "sqlparse",
"specs": [
[
"==",
"0.5.0"
]
]
},
{
"name": "tomli",
"specs": [
[
"==",
"2.0.1"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
"==",
"4.11.0"
]
]
},
{
"name": "virtualenv",
"specs": [
[
"==",
"20.26.2"
]
]
},
{
"name": "wheel",
"specs": [
[
"==",
"0.43.0"
]
]
},
{
"name": "zipp",
"specs": [
[
"==",
"3.19.1"
]
]
}
],
"tox": true,
"lcname": "djangocms-snippet"
}