1 2 3 4 5 6 7 8 9 10 11 | from django import template
register = template.Library()
def do_colorize(value):
if not value:
return ''
result = sum([ord(c) for c in value])
return "#%X" % result
register.filter('colorize', do_colorize)
|
More like this
- Custom managers with chainable filters by itavor 5 years, 4 months ago
- Effective content caching for mass-load site using redirect feature by nnseva 1 year, 10 months ago
- Use crypt instead of sha1 as password hash algorithm by akaihola 5 years, 9 months ago
- PositionField by jpwatts 4 years, 10 months ago
- a simple tag with context by dsblank 3 years, 5 months ago
Comments