mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-01-01 10:02:01 +00:00
16 lines
340 B
Python
16 lines
340 B
Python
from django.db import models
|
|
|
|
from utils.xss_filter import XssHtml
|
|
|
|
|
|
class RichTextField(models.TextField):
|
|
__metaclass__ = models.SubfieldBase
|
|
|
|
def get_prep_value(self, value):
|
|
if not value:
|
|
value = ""
|
|
parser = XssHtml()
|
|
parser.feed(value)
|
|
parser.close()
|
|
return parser.getHtml()
|