django-classy-tags


Namedjango-classy-tags JSON
Version 4.1.0 PyPI version JSON
download
home_pagehttps://github.com/django-cms/django-classy-tags
SummaryClass based template tags for Django
upload_time2023-07-29 09:06:18
maintainerDjango CMS Association and contributors
docs_urlNone
authorJonas Obrist
requires_python>=3.8
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            
==================
Django Classy Tags
==================

|pypi| |build| |coverage|

The goal of this project is to create a new way of writing Django template tags
which is fully compatible with the current Django templating infrastructure.
This new way should be easy, clean and require as little boilerplate code as
possible while still staying as powerful as possible. Some features:

* Class based template tags.
* Template tag argument parser.
* Declarative way to define arguments.
* Supports (theoretically infinite) parse-until blocks.
* Extensible!


.. note:: 

    This project is considered 3rd party (no supervision by the `django CMS Association <https://www.django-cms.org/en/about-us/>`_). Join us on `Slack                 <https://www.django-cms.org/slack/>`_ for more information.


*******************************************
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/django-classy-tags/graphs/contributors>`_
section.


Documentation
=============

See ``REQUIREMENTS`` in the `setup.py <https://github.com/divio/django-classy-tags/blob/master/setup.py>`_
file for additional dependencies:

|python| |django|

Please refer to the documentation in the docs/ directory for more information or visit our
`online documentation <https://django-classy-tags.readthedocs.io>`_.


Example
-------

This is how a tag looks like using django-classy-tags:

.. code-block:: python

    from classytags.core import Options
    from classytags.helpers import AsTag
    from classytags.arguments import Argument
    from django import template

    register = template.Library()

    class Hello(AsTag):
        options = Options(
            Argument('name', required=False, default='world'),
            'as',
            Argument('varname', required=False, resolve=False)
        )

        def get_value(self, context, name):
            return 'hello %s' % name

    register.tag(Hello)

That's your standard *hello world* example. Which can be used like this:

* ``{% hello %}``: Outputs ``hello world``
* ``{% hello "classytags" %}``: Outputs ``hello classytags``
* ``{% hello as myvar %}``: Outputs nothing but stores ``hello world`` into the
  template variable ``myvar``.
* ``{% hello "my friend" as othervar %}``: Outputs nothing but stores
  ``hello my friend`` into the template variable ``othervar``.


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/django-classy-tags.svg
    :target: http://badge.fury.io/py/django-classy-tags
.. |build| image:: https://travis-ci.org/divio/django-classy-tags.svg?branch=master
    :target: https://travis-ci.org/divio/django-classy-tags
.. |coverage| image:: https://codecov.io/gh/divio/django-classy-tags/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/divio/django-classy-tags

.. |python| image:: https://img.shields.io/badge/python-3.7+-blue.svg
    :target: https://pypi.org/project/django-classy-tags/
.. |django| image:: https://img.shields.io/badge/django-3.2,%204.0,%204.0-blue.svg
    :target: https://www.djangoproject.com/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/django-cms/django-classy-tags",
    "name": "django-classy-tags",
    "maintainer": "Django CMS Association and contributors",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "info@django-cms.org",
    "keywords": "",
    "author": "Jonas Obrist",
    "author_email": "ojiidotch@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/91/7f/18da9d8fcc469fc7aa74abc526aacaa3cc7180ad2208f80d43e8b670aed6/django-classy-tags-4.1.0.tar.gz",
    "platform": null,
    "description": "\n==================\nDjango Classy Tags\n==================\n\n|pypi| |build| |coverage|\n\nThe goal of this project is to create a new way of writing Django template tags\nwhich is fully compatible with the current Django templating infrastructure.\nThis new way should be easy, clean and require as little boilerplate code as\npossible while still staying as powerful as possible. Some features:\n\n* Class based template tags.\n* Template tag argument parser.\n* Declarative way to define arguments.\n* Supports (theoretically infinite) parse-until blocks.\n* Extensible!\n\n\n.. note:: \n\n    This project is considered 3rd party (no supervision by the `django CMS Association <https://www.django-cms.org/en/about-us/>`_). Join us on `Slack                 <https://www.django-cms.org/slack/>`_ for more information.\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/django-classy-tags/graphs/contributors>`_\nsection.\n\n\nDocumentation\n=============\n\nSee ``REQUIREMENTS`` in the `setup.py <https://github.com/divio/django-classy-tags/blob/master/setup.py>`_\nfile for additional dependencies:\n\n|python| |django|\n\nPlease refer to the documentation in the docs/ directory for more information or visit our\n`online documentation <https://django-classy-tags.readthedocs.io>`_.\n\n\nExample\n-------\n\nThis is how a tag looks like using django-classy-tags:\n\n.. code-block:: python\n\n    from classytags.core import Options\n    from classytags.helpers import AsTag\n    from classytags.arguments import Argument\n    from django import template\n\n    register = template.Library()\n\n    class Hello(AsTag):\n        options = Options(\n            Argument('name', required=False, default='world'),\n            'as',\n            Argument('varname', required=False, resolve=False)\n        )\n\n        def get_value(self, context, name):\n            return 'hello %s' % name\n\n    register.tag(Hello)\n\nThat's your standard *hello world* example. Which can be used like this:\n\n* ``{% hello %}``: Outputs ``hello world``\n* ``{% hello \"classytags\" %}``: Outputs ``hello classytags``\n* ``{% hello as myvar %}``: Outputs nothing but stores ``hello world`` into the\n  template variable ``myvar``.\n* ``{% hello \"my friend\" as othervar %}``: Outputs nothing but stores\n  ``hello my friend`` into the template variable ``othervar``.\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/django-classy-tags.svg\n    :target: http://badge.fury.io/py/django-classy-tags\n.. |build| image:: https://travis-ci.org/divio/django-classy-tags.svg?branch=master\n    :target: https://travis-ci.org/divio/django-classy-tags\n.. |coverage| image:: https://codecov.io/gh/divio/django-classy-tags/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/divio/django-classy-tags\n\n.. |python| image:: https://img.shields.io/badge/python-3.7+-blue.svg\n    :target: https://pypi.org/project/django-classy-tags/\n.. |django| image:: https://img.shields.io/badge/django-3.2,%204.0,%204.0-blue.svg\n    :target: https://www.djangoproject.com/\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Class based template tags for Django",
    "version": "4.1.0",
    "project_urls": {
        "Homepage": "https://github.com/django-cms/django-classy-tags"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6d1013afc12b7d9657ed67f8d49c1cf0585a4331b197ed98ea654e9ed8034e79",
                "md5": "9f97eb91a5582fb5758f8af1d09053d1",
                "sha256": "1c784cf1bac49c20a77b8f7d1541867c64076642a160a847ff449588d4e01e55"
            },
            "downloads": -1,
            "filename": "django_classy_tags-4.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9f97eb91a5582fb5758f8af1d09053d1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 14095,
            "upload_time": "2023-07-29T09:06:16",
            "upload_time_iso_8601": "2023-07-29T09:06:16.951028Z",
            "url": "https://files.pythonhosted.org/packages/6d/10/13afc12b7d9657ed67f8d49c1cf0585a4331b197ed98ea654e9ed8034e79/django_classy_tags-4.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "917f18da9d8fcc469fc7aa74abc526aacaa3cc7180ad2208f80d43e8b670aed6",
                "md5": "1ed1157412a8d9a2bf773ca652e6253a",
                "sha256": "c8d9d1aa2fa6e71c4d866df4dd11d23a69b8d25bbb750b2490a17b161774ee59"
            },
            "downloads": -1,
            "filename": "django-classy-tags-4.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1ed1157412a8d9a2bf773ca652e6253a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 24692,
            "upload_time": "2023-07-29T09:06:18",
            "upload_time_iso_8601": "2023-07-29T09:06:18.646666Z",
            "url": "https://files.pythonhosted.org/packages/91/7f/18da9d8fcc469fc7aa74abc526aacaa3cc7180ad2208f80d43e8b670aed6/django-classy-tags-4.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-29 09:06:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "django-cms",
    "github_project": "django-classy-tags",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "django-classy-tags"
}
        
Elapsed time: 0.12804s