Fixes in corefields
This commit is contained in:
parent
fbb2e1012c
commit
8e05927a32
7 changed files with 21 additions and 8 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from paramecio2.libraries.db.webmodel import PhangoField
|
||||
from paramecio2.libraries.db import coreforms
|
||||
from paramecio2.libraries.i18n import I18n
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
class IntegerField(PhangoField):
|
||||
|
||||
|
|
@ -157,10 +158,17 @@ class HTMLField(TextField):
|
|||
|
||||
def __init__(self, name, required=False):
|
||||
super().__init__(name, required)
|
||||
self.trusted_tags=[]
|
||||
|
||||
def check(self, value):
|
||||
|
||||
return re.sub('<.*?script?>', '', value)
|
||||
soup=BeautifulSoup(value, features='html.parser')
|
||||
|
||||
for tag in soup.findAll(True):
|
||||
if tag.name not in self.trusted_tags:
|
||||
tag.hidden=True
|
||||
|
||||
return soup.renderContents().decode('utf-8')
|
||||
|
||||
|
||||
class ForeignKeyField(IntegerField):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue