If you do not want to use separate libraries, you can import the standard django utilities. For instance:
from django.utils.html import strip_tags html = '<b><a href="http://foo.com/">foo</a></b><img src="http://foo.com/bar.jpg' stripped = strip_tags(html) print stripped
It is also already included in Django templates, so you do not need anything else, just use a filter, for example:
{{ unsafehtml|striptags }}
Btw, this is one of the fastest ways.
source share