A version of {% include %} that accepts multiple template names.
Usage
Add multiple_include to INSTALLED_APPS.
Then, in your template:
{% load multiple_include %}
{% multiple_include "template1.html" "template2.html" "template2.html" with object=item %}
The templatetag will include the first existing template from the list. This allows more interesting uses as:
{% load multiple_include %}
{% with "story_"|add:object.category_slug|add:".html" as category_template %}
{% multiple_include category_template "news/story_default.html" %}
{% endwith %}
Note: For a cleaner string concatenation, you can use the capture tag shipped with Django Basic Apps:
In your settings:
INSTALLED_APPS += ('basic.tools')
Template:
{% load multiple_include capture %}
{% capture as category_template %}
story_{{ object.category_slug}}.html
{% endcapture %}
{% multiple_include category_template "news/story_default.html" %}
Metadata
Release files for django-multiple-include 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-multiple-include-0.0.1.tar.gz | 6.5 kB | Without provenance | Details |
Release files / django-multiple-include-0.0.1.tar.gz
| Download URL | django-multiple-include-0.0.1.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
272208fe8f8d7247f4fffc81a3f924424daf93093999244ccd4f0b91ff89ef2c
|
|
BLAKE2b-256 checksum How to use checksums |
b02730f0c6a2f80f85ac7962471ba88e49f32e66013aa72121147ca785207644
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-multiple-include 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.