Skip to main content

Override blocks in included templates

Project description

django-embed-template

This 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.

Installation

Simply get the package from pip:

pip install django-embed-template

Then make sure to add django_embed_template to your INSTALLED_APPS in your settings.py.

Usage

Unlike {% 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.

TODO add an example

License

This 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.

django-embed-template Changelog

0.1.2 (2016-08-10)

  • Fix packaging to actually include code.

0.1.1 (2016-07-31)

  • Fix embedding the same template more than once.

0.1.0 (2016-07-30)

  • Initial working prototype

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-embed-template, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size django_embed_template-0.1.2-py2.py3-none-any.whl (5.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django-embed-template-0.1.2.tar.gz (6.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page