1 2 3 4 5 6 7 8 9 10 11 | from django import template
from django.utils.html import escape
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter()
def htmlentities(s):
return mark_safe(escape(s).encode('ascii', 'xmlcharrefreplace'))
|
More like this
- Improved Pickled Object Field by taavi223 3 years, 9 months ago
- Convert Unicode to ASCII by coordt 5 years, 3 months ago
- Dynamic Regroup Template Tag by btaylordesign 1 year, 9 months ago
- Amazon S3 browser-based upload form(FIXED) by grillermo 7 months, 2 weeks ago
- Character encoding fix by mrtron 5 years ago
Comments