增加富文本的 xss 过滤
This commit is contained in:
14
utils/models.py
Normal file
14
utils/models.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# coding=utf-8
|
||||
from django.db import models
|
||||
|
||||
from utils.xss_filter import XssHtml
|
||||
|
||||
|
||||
class RichTextField(models.TextField):
|
||||
__metaclass__ = models.SubfieldBase
|
||||
|
||||
def get_prep_value(self, value):
|
||||
parser = XssHtml()
|
||||
parser.feed(value)
|
||||
parser.close()
|
||||
return parser.getHtml()
|
||||
Reference in New Issue
Block a user