from django.utils.html import strip_tags_re from django.utils.encoding import force_text from django.utils.functional import allow_lazy def strip_tags(value): """Returns the given HTML with all tags replaced with single space.""" return strip_tags_re.sub(' ', force_text(value)) strip_tags = allow_lazy(strip_tags)