{ "info": { "author": "James Socol", "author_email": "me@jamessocol.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. _jingo:\n.. module:: jingo\n\n=====\nJingo\n=====\n\n.. note:: This document may be out of date. The up-to-date documentation can\n be found on `Read the Docs `_.\n\n\nJingo is an adapter for using Jinja2_ templates within Django.\n\n\nJingo is DEPRECATED\n-------------------\n\nIn version 1.8, Django added support for multiple template engines, and provided\na Jinja2 backend. The django-jinja_ project leverages that to support Jinja2,\nwhile Jingo does not.\n\n**django-jinja is recommended for new projects.** Jingo >=0.8 supports Django\n1.8, but it will not be maintained beyond version 0.9, and **will not** support\nDjango 1.9 or above. If you're already using Jingo, and not ready to make `the\nswitch`_, Jingo should continue to work for now, though not without some effort.\n\n0.9_ will be the last release of Jingo, unless a new maintainer comes along with\na new direction.\n\nAs of 0.9, Jingo's built-in helpers are provided via a `Jinja2 extension`_ to\nsimplify moving away from Jingo. The entire ``jingo/ext.py`` file can be copied\ninto another project, or referenced as ``'jingo.ext.JingoExtension'``. Used in\nthis way, Jingo plays nicely with django-jinja (and theoretically Django's\nbuilt-in Jinja2 backend).\n\n.. _django-jinja: https://github.com/niwinz/django-jinja\n.. _the switch: http://bluesock.org/~willkg/blog/mozilla/input_django_1_8_upgrade.html#switching-from-jingo-to-django-jinja\n.. _Jinja2: http://jinja.pocoo.org/2/\n.. _0.9: https://https://pypi.python.org/pypi/jingo/0.9.0\n.. _Jinja2 extension: https://github.com/jbalogh/jingo/blob/master/jingo/ext.py\n\n\n.. _usage:\n\nUsage\n-----\n\nWhen configured properly (see Settings_ below) you can render Jinja2_ templates in\nyour view the same way you'd render Django templates::\n\n from django.shortcuts import render\n\n\n def my_view(request):\n context = dict(user_ids=(1, 2, 3, 4))\n return render(request, 'users/search.html', context)\n\n.. note::\n\n Not only does ``django.shorcuts.render`` work, but so does any method that\n Django provides to render templates.\n\n.. _settings:\n\nSettings\n--------\n\nYou'll want to use Django to use jingo's template loader.\nIn ``settings.py``::\n\n TEMPLATE_LOADERS = (\n 'jingo.Loader',\n 'django.template.loaders.filesystem.Loader',\n 'django.template.loaders.app_directories.Loader',\n )\n\nThis will let you use ``django.shortcuts.render`` or\n``django.shortcuts.render_to_response``.\n\nYou can optionally specify which filename patterns to consider Jinja2 templates::\n\n JINGO_INCLUDE_PATTERN = r'\\.jinja2' # use any regular expression here\n\nThis will consider every template file that contains the substring `.jinja2` to\nbe a Jinja2 file (unless it's in a module explicitly excluded, see below).\n\nAnd finally you may have apps that do not use Jinja2, these must be excluded\nfrom the loader::\n\n JINGO_EXCLUDE_APPS = ('debug_toolbar',)\n\nIf a template path begins with ``debug_toolbar``, the Jinja loader will raise a\n``TemplateDoesNotExist`` exception. This causes Django to move onto the next\nloader in ``TEMPLATE_LOADERS`` to find a template - in this case,\n``django.template.loaders.filesystem.Loader``.\n\n.. note::\n Technically, we're looking at the template path, not the app. Often these are\n the same, but in some cases, like 'registration' in the default setting--which\n is an admin template--they are not.\n\nThe default is in ``jingo.EXCLUDE_APPS``::\n\n EXCLUDE_APPS = (\n 'admin',\n 'admindocs',\n 'registration',\n 'context_processors',\n )\n\n.. versionchanged:: 0.6.2\n Added ``context_processors`` application.\n\nIf you want to configure the Jinja environment, use ``JINJA_CONFIG`` in\n``settings.py``. It can be a dict or a function that returns a dict. ::\n\n JINJA_CONFIG = {'autoescape': False}\n\nor::\n\n def JINJA_CONFIG():\n return {'the_answer': 41 + 1}\n\nIf you set the ``extensions`` key in the configuration, you **must**\ninclude ``jingo.ext.JingoExtension`` to get Jingo's built-in template\nhelpers (see below).\n\n\nTemplate Helpers\n----------------\n\n.. note::\n\n In the interest of future-proofing, consider writing custom filters and\n functions as Jinja extensions. See ``jingo/ext.py`` for a simple example.\n\nInstead of template tags, Jinja encourages you to add functions and filters to\nthe templating environment. In ``jingo``, we call these helpers. When the\nJinja environment is initialized, ``jingo`` will try to open a ``helpers.py``\nfile from every app in ``INSTALLED_APPS``. Two decorators are provided to ease\nthe environment extension:\n\n.. function:: jingo.register.filter\n\n Adds the decorated function to Jinja's filter library.\n\n.. function:: jingo.register.function\n\n Adds the decorated function to Jinja's global namespace.\n\n\nDefault Helpers\n~~~~~~~~~~~~~~~\n\nHelpers are available in all templates automatically, without any extra\nloading. See ``jingo/ext.py`` for their definitions.\n\n\nTemplate Environment\n--------------------\n\nA single Jinja ``Environment`` is created for use in all templates. This is\navailable via ``jingo.get_env()`` if you need to work with the ``Environment``.\n\n\nLocalization\n------------\n\nSince we all love L10n, let's see what it looks like in Jinja templates::\n\n

{{ _('Reviews for {0}')|f(addon.name) }}

\n\nThe simple way is to use the familiar underscore and string within a ``{{ }}``\nmoustache block. ``f`` is an interpolation filter documented below. Sphinx\ncould create a link if I knew how to do that.\n\nThe other method uses Jinja's ``trans`` tag::\n\n {% trans user=review.user|user_link, date=review.created|datetime %}\n by {{ user }} on {{ date }}\n {% endtrans %}\n\n``trans`` is nice when you have a lot of text or want to inject some variables\ndirectly. Both methods are useful, pick the one that makes you happy.\n\n\nForms\n-----\n\nDjango marks its form HTML \"safe\" according to its own rules, which Jinja2 does\nnot recognize.\n\nThis monkeypatches Django to support the ``__html__`` protocol used in Jinja2\ntemplates. ``Form``, ``BoundField``, ``ErrorList``, and other form objects that\nrender HTML through their ``__unicode__`` method are extended with ``__html__``\nso they can be rendered in Jinja2 templates without adding ``|safe``.\n\nCall the ``patch()`` function to execute the patch. It must be called\nbefore ``django.forms`` is imported for the conditional_escape patch to work\nproperly. The root URLconf is the recommended location for calling ``patch()``.\n\nUsage::\n\n import jingo.monkey\n jingo.monkey.patch()\n\n\nTesting\n-------\n\nTo run the test suite, you need to define ``DJANGO_SETTINGS_MODULE`` first::\n\n $ export DJANGO_SETTINGS_MODULE=\"fake_settings\"\n $ nosetests\n\nor simply run::\n\n $ python run_tests.py\n\nTo test on all supported versions of Python and Django::\n\n $ pip install tox\n $ tox", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/jbalogh/jingo", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "jingo", "package_url": "https://pypi.org/project/jingo/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/jingo/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/jbalogh/jingo" }, "release_url": "https://pypi.org/project/jingo/0.9.0/", "requires_dist": null, "requires_python": null, "summary": "An adapter for using Jinja2 templates with Django.", "version": "0.9.0" }, "last_serial": 2141169, "releases": { "0.4": [ { "comment_text": "", "digests": { "md5": "dfffbff62ddfc28dfe26866d6dcb46ae", "sha256": "efc0ed9ccdc5090d88b4fa13356641eb9026b1bee978e54a59b54f44eea5a5ce" }, "downloads": -1, "filename": "jingo-0.4.tar.gz", "has_sig": false, "md5_digest": "dfffbff62ddfc28dfe26866d6dcb46ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7125, "upload_time": "2011-10-28T19:26:17", "url": "https://files.pythonhosted.org/packages/ff/da/2cab75d010180a64e437f3802d881e0d93456025e565881ead4ae82f0bdb/jingo-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "6f0a19a58ba6c342ce53cf27b9c7ba87", "sha256": "7ee70088430feceab535fca95dbe95107c02b3b80277745921a9eac4a0aff405" }, "downloads": -1, "filename": "jingo-0.5.tar.gz", "has_sig": false, "md5_digest": "6f0a19a58ba6c342ce53cf27b9c7ba87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8468, "upload_time": "2012-11-14T00:02:11", "url": "https://files.pythonhosted.org/packages/44/d6/897ce5ea5ed5310afa39f5aadcbee6485590a53f0d40818ff1f153b1aff4/jingo-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "df9c88ac77a5070e227735204f6e5c6b", "sha256": "39b4616affb0b6207ed3c57c33d412d55012637ee00c8ea7aca0d7535be56dbc" }, "downloads": -1, "filename": "jingo-0.6.tar.gz", "has_sig": false, "md5_digest": "df9c88ac77a5070e227735204f6e5c6b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8415, "upload_time": "2012-11-30T19:32:22", "url": "https://files.pythonhosted.org/packages/4c/b1/2c37a22114c09b05b8036faa0bd61c8d45186d601efa8705d3e87c09e8a1/jingo-0.6.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "ef029f2dea05a31b76e427a430de24a2", "sha256": "1491c3ed98f819c082a6e58b6bae765ecd8ebfc4805b6eddaaeb9070b6deda21" }, "downloads": -1, "filename": "jingo-0.6.1.tar.gz", "has_sig": false, "md5_digest": "ef029f2dea05a31b76e427a430de24a2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8769, "upload_time": "2013-01-09T19:21:56", "url": "https://files.pythonhosted.org/packages/f3/13/23d1c3fb6c8d1c051d510119a5e502b12fa0894c4dae6af55c2a480e1547/jingo-0.6.1.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "9dc64022a850b99f4c94de2d783deb08", "sha256": "a3bd5051dd17e9d50e8a9f2d362508e82d7063010fdc06d5e07ce3608e780fe6" }, "downloads": -1, "filename": "jingo-0.7.tar.gz", "has_sig": false, "md5_digest": "9dc64022a850b99f4c94de2d783deb08", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9365, "upload_time": "2014-01-07T19:14:22", "url": "https://files.pythonhosted.org/packages/72/3f/2e4df4974a31dc131ae629493da7921d6a112a75f829096860a2a8bda5dd/jingo-0.7.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "511a7400152b6a990541c3362e121e55", "sha256": "c495a8dfd0a9c1d3d8ed02121bbb28b6c9d34d4da30aa93a7e639c0f3d7b0639" }, "downloads": -1, "filename": "jingo-0.7.1.tar.gz", "has_sig": false, "md5_digest": "511a7400152b6a990541c3362e121e55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9982, "upload_time": "2015-05-13T13:52:57", "url": "https://files.pythonhosted.org/packages/42/cb/b977c8132ac301646a8a5c5bb8e6802468e1fd9c937f8e52ba2e939beb03/jingo-0.7.1.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "4ec6eef213946fb8404b76280acae3ed", "sha256": "f119833971f708dc158664123edc89c7bc989261a4a00752c1c43d7a0eaed04c" }, "downloads": -1, "filename": "jingo-0.8-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4ec6eef213946fb8404b76280acae3ed", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13226, "upload_time": "2015-10-20T12:47:28", "url": "https://files.pythonhosted.org/packages/87/b2/0fb7e1a5710499ad54172373924df0e4eec84c0a2bc88aa6b810b0bb8761/jingo-0.8-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f6f078620c7895af5086eb0a19e31a29", "sha256": "ba1f0e20d5dd3dd2a6b0e3010c16554c3902423b09ee4ed56d50bc8f0b5546b0" }, "downloads": -1, "filename": "jingo-0.8.tar.gz", "has_sig": false, "md5_digest": "f6f078620c7895af5086eb0a19e31a29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10412, "upload_time": "2015-10-20T12:47:24", "url": "https://files.pythonhosted.org/packages/36/ab/4844ca03a38c5f9dd15b08b4f43a3ec9e7fb5e9316f6b0d45d40dce2bd22/jingo-0.8.tar.gz" } ], "0.8.1": [ { "comment_text": "", "digests": { "md5": "ceaa180583edda805a9acaaf3a6b675a", "sha256": "719ca165ce8becaf8d16b1596e863a380474c30ce5d239c6f0c1243f73f0fa20" }, "downloads": -1, "filename": "jingo-0.8.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ceaa180583edda805a9acaaf3a6b675a", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 12658, "upload_time": "2015-10-24T16:12:54", "url": "https://files.pythonhosted.org/packages/3a/90/3385242a04477424fc087411e1f74ac11c7d7904f5a3db6e817b52fe8347/jingo-0.8.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "259b410d102c4b5935a0e578e04bd005", "sha256": "9757e570834d65ae9f3363d96439b6bf9845e0100ea3c4a01f52fddf3dcaf3bd" }, "downloads": -1, "filename": "jingo-0.8.1.tar.gz", "has_sig": false, "md5_digest": "259b410d102c4b5935a0e578e04bd005", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9941, "upload_time": "2015-10-24T16:12:50", "url": "https://files.pythonhosted.org/packages/69/e8/e2115c5ea652a97d3b52af7c8e3bec5290f3a9136d4f5219766dcd7dc427/jingo-0.8.1.tar.gz" } ], "0.8.2": [ { "comment_text": "", "digests": { "md5": "5d9047a08cd6bfb5897545d01607ea61", "sha256": "b00307ff9178086707dccbf7193f771bc57d10b3253d05fc507142c79a512a5a" }, "downloads": -1, "filename": "jingo-0.8.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5d9047a08cd6bfb5897545d01607ea61", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 12675, "upload_time": "2016-01-07T19:51:58", "url": "https://files.pythonhosted.org/packages/e3/70/22ed9eb0a087a7db579627e78f6f3492652341deb5514b39629de406bc2b/jingo-0.8.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "953b374a3644e977b5cf729c5e907685", "sha256": "f23ac2da63eb1a92ec94522034f6c34ae95b3846ee1c20758921125a82e2f358" }, "downloads": -1, "filename": "jingo-0.8.2.tar.gz", "has_sig": false, "md5_digest": "953b374a3644e977b5cf729c5e907685", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10008, "upload_time": "2016-01-07T19:51:47", "url": "https://files.pythonhosted.org/packages/ef/1a/3244e67cc99e3974df1f0eaa579f4661dd0e2ec0db161b4443029edfed45/jingo-0.8.2.tar.gz" } ], "0.9.0": [ { "comment_text": "", "digests": { "md5": "2395c43469b695646a577f68e08c15fa", "sha256": "12a983286519303c6afd3da6f0a7e1859e69effb5fe46109424cdfca382bea56" }, "downloads": -1, "filename": "jingo-0.9.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2395c43469b695646a577f68e08c15fa", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 15155, "upload_time": "2016-05-30T18:34:51", "url": "https://files.pythonhosted.org/packages/c5/02/fb6889dfe8a2ece21765fb4501b4f664d9c6e582b96ce816d6b2cd277458/jingo-0.9.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9c40953d0e20afadc9849cd7e727efb1", "sha256": "37de5435622d05763bc55d1a3d0a7edcf998ece9e6048bb470db431d1aa83c3a" }, "downloads": -1, "filename": "jingo-0.9.0.tar.gz", "has_sig": false, "md5_digest": "9c40953d0e20afadc9849cd7e727efb1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10536, "upload_time": "2016-05-30T18:34:01", "url": "https://files.pythonhosted.org/packages/04/c2/c007aa5af20f63169a88fb0fa05a0003531b5d5751cbf720193c6f11be4b/jingo-0.9.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2395c43469b695646a577f68e08c15fa", "sha256": "12a983286519303c6afd3da6f0a7e1859e69effb5fe46109424cdfca382bea56" }, "downloads": -1, "filename": "jingo-0.9.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2395c43469b695646a577f68e08c15fa", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 15155, "upload_time": "2016-05-30T18:34:51", "url": "https://files.pythonhosted.org/packages/c5/02/fb6889dfe8a2ece21765fb4501b4f664d9c6e582b96ce816d6b2cd277458/jingo-0.9.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9c40953d0e20afadc9849cd7e727efb1", "sha256": "37de5435622d05763bc55d1a3d0a7edcf998ece9e6048bb470db431d1aa83c3a" }, "downloads": -1, "filename": "jingo-0.9.0.tar.gz", "has_sig": false, "md5_digest": "9c40953d0e20afadc9849cd7e727efb1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10536, "upload_time": "2016-05-30T18:34:01", "url": "https://files.pythonhosted.org/packages/04/c2/c007aa5af20f63169a88fb0fa05a0003531b5d5751cbf720193c6f11be4b/jingo-0.9.0.tar.gz" } ] }