OnlineJudge/utils/models.py

11 lines
285 B
Python
Raw Normal View History

2017-10-11 13:43:29 +00:00
from django.contrib.postgres.fields 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 "")