1 2 3 4 5 6 7 8 9 10 11 12 13 | from django import template
register = template.Library()
@register.filter
def html_encode(text):
return ''.join(map(lambda c:'%%%x'%ord(c),text))
html_encode.is_safe=True
@register.filter
def html_encode_email(email):
return '<a href="mailto:%s">%s</a>' % (html_encode(email),email)
html_encode_email.is_safe=True
|
More like this
- Class-Based AJAX fallback view by fahhem 2 years, 3 months ago
- Resolve URLs to view name and args/kwargs by fahhem 2 years, 6 months ago
- Template tag to create mailto links with options by celopes 3 years, 11 months ago
- encode_mailto by santuri 6 years ago
- hide_email by rukeba 5 years ago
Comments