def setUp(self): self.parser = HTMLEscaper()
def escape_html(raw_text): parser = HTMLEscaper() new_html = parser.clean(raw_text) return mark_safe(new_html)
def clean_text(sender, instance, **kwargs): """pre_save receiver that cleans up the text before saving eg. escape HTML""" if not kwargs['raw']: parser = HTMLEscaper() instance.text = parser.clean(instance.text)