Decode HTML Template Tag

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from django import template
import HTMLParser

register = template.Library()

@register.filter
def decode(value):
    """HTML decodes a string """
    h = HTMLParser.HTMLParser()
    return h.unescape(value)

More like this

  1. testdata tag for templates by showell 4 years ago
  2. Encode emails as URIs by fahhem 2 years, 9 months ago
  3. SOAP views with on-demand WSDL generation by chewie 4 years, 9 months ago
  4. Tags & filters for rendering search results by exogen 5 years, 2 months ago
  5. Yet another SQL debugging facility by miracle2k 5 years, 9 months ago

Comments

(Forgotten your password?)