A library to make Django's template tags sweet.
Project description
A library to make writing templatetags in Django sweet.
Here’s an example of using:
from django import template
from templatetag_sugar.register import tag
from templatetag_sugar.parser import Name, Variable, Constant, Optional, Model
register = template.Library()
@tag(register, [Constant("for"), Variable(), Optional([Constant("as"), Name()])]):
def example_tag(context, val, asvar=None):
if asvar:
context[asvar] = val
return ""
else:
return val
As you can see it makes it super simple to define the syntax for a tag.
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
Close
Hashes for django-templatetag-sugarv2-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 051097a4d9134c8ac0ba9dec4a749ce7744e6e21c8da9e8bfd49a7ad8732fffb |
|
MD5 | 33fe09d5d6564be1621bf896ed227d63 |
|
BLAKE2b-256 | 2042202953087a1ce92a4d220e3822eb653d7c2fe881a789d5a66f8e16dbcf13 |
Close
Hashes for django_templatetag_sugarv2-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88f1723257a68407df8ad9b99a77d53cb06ecc7a1b8ded90978e06993305b46c |
|
MD5 | f0af13e6bee19cedef23c6b585a18aa5 |
|
BLAKE2b-256 | ad67c7271d606c2fde4d75476d94fdb0ff703040a51e29ea861a9f1f16fb34d5 |