1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | @register.filter(name='secure_mail')
@stringfilter
def secure_mail(value):
"""
Returns a somewhat safer email address
Usage:
{{ "mailto:me@domain.com"|secure_mail }}
Outputs:
mailto:me@domain.com
"""
try:
return "".join(["&#%s;" %(ord(c)) for c in value])
except:
return value
secure_mail.is_safe = True # because "&" is renderd with autoescape by default
|
More like this
- encode_mailto by santuri 6 years ago
- Email Munger by cootetom 4 years, 4 months ago
- Template Tag to protect the E-mail address by nitinhayaran 3 years, 3 months ago
- Decode HTML Template Tag by megamark16 1 year, 2 months ago
- Encode emails as URIs by fahhem 2 years, 9 months ago
Comments