A template tag to allow writing mixins instead of defining more files.
Project description
A template filter that allows you to define and use mixins.
Installation
In your Django project, run:
pip install django-template-mixins
and add mixin_templatetag to your INSTALLED_APPS setting:
INSTALLED_APPS = [ ..., 'mixin_templatetag' ]
and from there you can use it as follows:
{% load mixins %} {% mixin foo %} <div> <div>{{ name }}</div> <div>{{ description }}</div> </div> {% endmixin %} {% block content %} ... {% mix foo with name="hello" description="world" %} ... {% endblock %}
Why django-template-mixins?
Currently in Django, if you want to repeat a block multiple times in separate blocks / areas in the same block, you have to create a separate file. The worst part is that these extracted bits of template tend to be single purpose - you aren’t likely to need it anywhere else besides that first template.
Mixins allow you to keep things in one place and allows you to avoid DRY.
Reporting bugs
You can report bugs in https://github.com/benlei/django-template-mixins/issues.
If you believe you’ve found a bug, please try to identify the root cause and write up some sample code on how to reproduce it.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-template-mixins-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc8978d22f8edf582b1567c77f2afa41fe0d5999999dc2cf9836d47aae31fc72 |
|
MD5 | 277ccd609d5bf9d4ddf475655c7df499 |
|
BLAKE2b-256 | 168a0a14341d3e9d788a529d4e284acc49e6131fc051f4a7cf2e3f8f534ece7c |
Hashes for django_template_mixins-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f99842a5b52cbcc84cb35eb83fb24d3677a7749d7b6194ba25f191b6930afef4 |
|
MD5 | 6c7ad2d2930c5f0bf6092c858ae09b18 |
|
BLAKE2b-256 | d063467569632dfe50541ef387c19132cce40c96b7bbecc97e7b1c9bc145980b |