{ "info": { "author": "Joost Rijneveld", "author_email": "joost@joostrijneveld.nl", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: User Interfaces" ], "description": "django-embed-template |travis|\r\n==============================\r\n\r\n.. |travis| image:: https://travis-ci.org/joostrijneveld/django-embed-template.svg?branch=master\r\n :target: https://travis-ci.org/joostrijneveld/django-embed-template\r\n\r\nThis package adds the ``{% embed %}`` templatetag. This tag combines the functionality of `the include tag `__ and `the extends tag `__ to allow for more flexible and extensible modular template usage. Inspired by `twig's embed tag `__, this tag lets you override blocks that were defined in the included template.\r\n\r\nRequirements\r\n------------\r\n\r\nThis package is tested with Django 1.8, 1.9 and 1.10 and their respectively supported Python versions.\r\n\r\nInstallation\r\n------------\r\n\r\nSimply get the package from ``pip``:\r\n\r\n::\r\n\r\n pip install django-embed-template\r\n\r\nThen make sure to add ``django_embed_template`` to your ``INSTALLED_APPS`` in your ``settings.py``.\r\n\r\nUsage\r\n-----\r\n\r\nUnlike ``{% extends %}``, the ``{% embed %}`` tag can be repeated in the template and does not have to occur as the first tag (essentially like the ``{% include %}`` tag). Likewise, ``{% embed %}`` inherits the context by default, and allows you to pass additional context using the ``with`` keyword. Passing only the explicitly listed variables can be achieved using the ``only`` keyword.\r\n\r\nIn many cases ``{% include %}`` simply suffices. However, in more complex scenarios it has a tendency to create an exponential number of combined templates. This typically happens when the content of the included template is itself dynamic. Consider the following example (inspired by `twig's documentation `__):\r\n\r\nAssume we have some ``base.html`` that contains a `content` block. In this block, we want to create vertical and horizontal sub-blocks. Assume we have ``vertical.html`` that contains two boxes sides by side with respectively ``{% block A %}`` and ``{% block B %}`` inside, as well as ``horizontal.html`` containing three stacked boxes with similarly labeled blocks. Our page could then look something like this:\r\n\r\n::\r\n\r\n {% extends 'base.html' %}\r\n {% block content %}\r\n {% embed 'vertical.html' %}\r\n {% block A %}Arthur, King of the Britons{% endblock %}\r\n {% block B %}Sir Lancelot{% endblock %}\r\n {% endembed %}\r\n {% embed 'horizontal.html' %}\r\n {% block A %}Sir Bedevere the Wise{% endblock %}\r\n {% block B %}Sir Robin the Not-Quite-So-Brave-as-Sir-Lancelot{% endblock %}\r\n {% block C %}\r\n Other knights:\r\n {% embed 'horizontal.html' with background='gray' %}\r\n {% block A %}Sir Galahad the Pure{% endblock %}\r\n {% block B %}Sir Not Appearing In This Film{% endblock %}\r\n {% endembed %}\r\n {% endblock %}\r\n {% endembed %}\r\n {% endblock %}\r\n\r\nNote that we're also nesting ``{% embed %}`` blocks, leaving some blocks unspecified, as well as passing context to one of the embedded templates. For more possible scenarios, browse through the `example templates `__.\r\n\r\nLicense\r\n-------\r\n\r\nThis package includes code that was directly derived from code from the Django project. The included django-LICENSE applies to those snippets. The included CC0 license applies to the rest of this project.\r\n\r\ndjango-embed-template Changelog\r\n===============================\r\n\r\n0.2.0 (2016-08-20)\r\n------------------\r\n\r\n- Allow for nesting of embed tags.\r\n- Include a set of test cases and examples.\r\n- Fix compatability with Python 2 and Django 1.8+\r\n\r\n0.1.2 (2016-08-10)\r\n------------------\r\n\r\n- Fix packaging to actually include code.\r\n\r\n0.1.1 (2016-07-31)\r\n------------------\r\n\r\n- Fix embedding the same template more than once.\r\n\r\n0.1.0 (2016-07-30)\r\n------------------\r\n\r\n- Initial working prototype", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/joostrijneveld/django-embed-template", "keywords": "django templates embedding", "license": "CC0", "maintainer": "", "maintainer_email": "", "name": "django-embed-template", "package_url": "https://pypi.org/project/django-embed-template/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-embed-template/", "project_urls": { "Homepage": "https://github.com/joostrijneveld/django-embed-template" }, "release_url": "https://pypi.org/project/django-embed-template/0.2.0/", "requires_dist": [ "django (>=1.8)" ], "requires_python": "", "summary": "Override blocks in included templates", "version": "0.2.0" }, "last_serial": 2292524, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "43a83b8825198b3d16c1843647f9f152", "sha256": "4d22465213ee168a86473530906f1ac2025784e2fc5d8055755badc8bd3a5624" }, "downloads": -1, "filename": "django_embed_template-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "43a83b8825198b3d16c1843647f9f152", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 3870, "upload_time": "2016-07-30T14:25:57", "url": "https://files.pythonhosted.org/packages/12/ad/85a4a03849c8234a116d2d9fc4fd900463c06b5e2484bf80bd2fb75df881/django_embed_template-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f36989290038fad2e66669df61efaa10", "sha256": "a02369b1d7f3e60250305a8cef8af4c204540890f05ff1f3a0f3beb439e3ee01" }, "downloads": -1, "filename": "django-embed-template-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f36989290038fad2e66669df61efaa10", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5375, "upload_time": "2016-07-30T14:25:59", "url": "https://files.pythonhosted.org/packages/53/1d/b71f12cf44729aa3d3d806d3a26cfd1f765f832b8e24b5485940eb8ae474/django-embed-template-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "13cecc860ae0b735f7cb561ce42f059c", "sha256": "fa55db353bab7a3570f26ae6890c8d192625a5b5fa38fcdbffcfffeaafd78e1c" }, "downloads": -1, "filename": "django_embed_template-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "13cecc860ae0b735f7cb561ce42f059c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4037, "upload_time": "2016-07-31T08:27:21", "url": "https://files.pythonhosted.org/packages/9f/93/202afc74541b361bfd6775829d6d85fa696c766ddc6fab107bb909e48c36/django_embed_template-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c19f281711c1de98e81828e798c4357d", "sha256": "f35fe3ab41aea9d7ed839834cca12e634340abb7eaabbb31bfe18469d39313e7" }, "downloads": -1, "filename": "django-embed-template-0.1.1.tar.gz", "has_sig": false, "md5_digest": "c19f281711c1de98e81828e798c4357d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5478, "upload_time": "2016-07-31T08:27:24", "url": "https://files.pythonhosted.org/packages/ed/82/1b84bec32ad4787fd702ea66340b0aaaa9b8bdba5c543f102b089a4f8750/django-embed-template-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "ed2aae21084bfcb30c32c7ad790dd38a", "sha256": "deedf2fd273f0d3dff83d17fcf99f5e46865e04b2481b3a53fdbc9dbc12b5f10" }, "downloads": -1, "filename": "django_embed_template-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ed2aae21084bfcb30c32c7ad790dd38a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5534, "upload_time": "2016-08-11T09:54:28", "url": "https://files.pythonhosted.org/packages/fd/d1/c0ef09f8ab42ee82d34206955a65585ae606f54d7e906a295928ea5b9ea7/django_embed_template-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3581900b93954203d4dc8a297b5469b6", "sha256": "09c9de58b295b5ec3f8218c3ac89cf81049aa81d4a1afcf7fae2b8661fb7ca46" }, "downloads": -1, "filename": "django-embed-template-0.1.2.tar.gz", "has_sig": false, "md5_digest": "3581900b93954203d4dc8a297b5469b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6627, "upload_time": "2016-08-11T09:54:31", "url": "https://files.pythonhosted.org/packages/b6/9d/05656681d513f651e671c3c3b946ccc5e75592d66e525a5d2e5a6ba5782b/django-embed-template-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "c3d0adc56224c00621b04b73ddbd84b0", "sha256": "df76c24703882fd19c9a812f698fae53a3457f2cfec30a8ea6ee60ca5e7d3d4c" }, "downloads": -1, "filename": "django_embed_template-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c3d0adc56224c00621b04b73ddbd84b0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7238, "upload_time": "2016-08-20T11:55:12", "url": "https://files.pythonhosted.org/packages/a4/64/9651467147ceb92b2d355a6ea1abb71cb5684a68a9c85d099451b456dc36/django_embed_template-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fc8c128439f1dadef71029ae1989bfda", "sha256": "af6ca44b1a3195ea645a802e593530449d27b0e2ba681c82bd7acf5af6721b7b" }, "downloads": -1, "filename": "django-embed-template-0.2.0.tar.gz", "has_sig": false, "md5_digest": "fc8c128439f1dadef71029ae1989bfda", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7702, "upload_time": "2016-08-20T11:55:15", "url": "https://files.pythonhosted.org/packages/68/67/cb8f3b472953d10e6f4c2b6b8d995341b6f4081ed2710dce248fe6b39ab7/django-embed-template-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c3d0adc56224c00621b04b73ddbd84b0", "sha256": "df76c24703882fd19c9a812f698fae53a3457f2cfec30a8ea6ee60ca5e7d3d4c" }, "downloads": -1, "filename": "django_embed_template-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c3d0adc56224c00621b04b73ddbd84b0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7238, "upload_time": "2016-08-20T11:55:12", "url": "https://files.pythonhosted.org/packages/a4/64/9651467147ceb92b2d355a6ea1abb71cb5684a68a9c85d099451b456dc36/django_embed_template-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fc8c128439f1dadef71029ae1989bfda", "sha256": "af6ca44b1a3195ea645a802e593530449d27b0e2ba681c82bd7acf5af6721b7b" }, "downloads": -1, "filename": "django-embed-template-0.2.0.tar.gz", "has_sig": false, "md5_digest": "fc8c128439f1dadef71029ae1989bfda", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7702, "upload_time": "2016-08-20T11:55:15", "url": "https://files.pythonhosted.org/packages/68/67/cb8f3b472953d10e6f4c2b6b8d995341b6f4081ed2710dce248fe6b39ab7/django-embed-template-0.2.0.tar.gz" } ] }