Source

django-swingcms / swingcms / cms / templatetags / cms_filters.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from django.template import Library
register = Library()

import settings
from cms.code import strip_tags



def clean(html, level):
    """
    Let only permitted tags, strip others.
    """
    return strip_tags(html, permitted_tags=getattr(settings, 'PERMITTED_TAGS%s' % level))

clean.is_safe = True

register.filter(clean)