djangocms-snippet


Namedjangocms-snippet JSON
Version 3.1.1 PyPI version JSON
download
home_pagehttps://github.com/django-cms/djangocms-snippet
SummaryAdds snippet plugin to django CMS.
upload_time2023-09-07 08:40:01
maintainerDjango CMS Association and contributors
docs_urlNone
authorDivio AG
requires_python>=3.5
licenseBSD-3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            ==================
django CMS Snippet
==================

|pypi| |coverage| |python| |django| |djangocms|


**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

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.5+-blue.svg
    :target: https://pypi.org/project/djangocms-snippet/
.. |django| image:: https://img.shields.io/badge/django-2.2,%203.0,%203.1-blue.svg
    :target: https://www.djangoproject.com/
.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-3.7%2B-blue.svg
    :target: https://www.django-cms.org/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/django-cms/djangocms-snippet",
    "name": "djangocms-snippet",
    "maintainer": "Django CMS Association and contributors",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "info@django-cms.org",
    "keywords": "",
    "author": "Divio AG",
    "author_email": "info@divio.ch",
    "download_url": "https://files.pythonhosted.org/packages/0d/88/a802646fb365abe6067489d0b78145e109601275f58a3a8f1bafe2ed191c/djangocms-snippet-3.1.1.tar.gz",
    "platform": null,
    "description": "==================\ndjango CMS Snippet\n==================\n\n|pypi| |coverage| |python| |django| |djangocms|\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\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.5+-blue.svg\n    :target: https://pypi.org/project/djangocms-snippet/\n.. |django| image:: https://img.shields.io/badge/django-2.2,%203.0,%203.1-blue.svg\n    :target: https://www.djangoproject.com/\n.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-3.7%2B-blue.svg\n    :target: https://www.django-cms.org/\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Adds snippet plugin to django CMS.",
    "version": "3.1.1",
    "project_urls": {
        "Homepage": "https://github.com/django-cms/djangocms-snippet"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "22142f9f61f7d9c263b323284122f65bf467a2c266b37c585a1aad467169e25e",
                "md5": "fb4882ef57ca596c04422fd7f93ff282",
                "sha256": "4bc50ca833615b6dde425711a4eda42bf63f226c3521580b15c44ff89c744432"
            },
            "downloads": -1,
            "filename": "djangocms_snippet-3.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fb4882ef57ca596c04422fd7f93ff282",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 138357,
            "upload_time": "2023-09-07T08:39:59",
            "upload_time_iso_8601": "2023-09-07T08:39:59.613709Z",
            "url": "https://files.pythonhosted.org/packages/22/14/2f9f61f7d9c263b323284122f65bf467a2c266b37c585a1aad467169e25e/djangocms_snippet-3.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0d88a802646fb365abe6067489d0b78145e109601275f58a3a8f1bafe2ed191c",
                "md5": "02ecec513e97defcb518e54ee1b41f5c",
                "sha256": "ecd4f43de121728d8f65b1267b88d66fa5b686f9bb7f79d3b15d7d2c5332c751"
            },
            "downloads": -1,
            "filename": "djangocms-snippet-3.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "02ecec513e97defcb518e54ee1b41f5c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 34647,
            "upload_time": "2023-09-07T08:40:01",
            "upload_time_iso_8601": "2023-09-07T08:40:01.417414Z",
            "url": "https://files.pythonhosted.org/packages/0d/88/a802646fb365abe6067489d0b78145e109601275f58a3a8f1bafe2ed191c/djangocms-snippet-3.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-07 08:40:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "django-cms",
    "github_project": "djangocms-snippet",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "djangocms-snippet"
}
        
Elapsed time: 0.16361s