OnlineJudge/utils/models.py

11 lines
271 B
Python
Raw Normal View History

from django.db.models import JSONField # NOQA
2015-09-22 09:03:53 +00:00
from django.db import models
2017-12-24 07:34:22 +00:00
from utils.xss_filter import XSSHtml
2015-09-22 09:03:53 +00:00
class RichTextField(models.TextField):
def get_prep_value(self, value):
2017-12-24 07:34:22 +00:00
with XSSHtml() as parser:
return parser.clean(value or "")