Added more tests
This commit is contained in:
parent
764a4863a2
commit
912f288f67
7 changed files with 183 additions and 7 deletions
|
|
@ -175,7 +175,7 @@ class TextField(PhangoField):
|
|||
class HTMLField(TextField):
|
||||
"""Class used for html fields
|
||||
|
||||
Class used for html fields, use TEXT sql type for the this field because is children of TextField.
|
||||
Class used for html fields, use TEXT sql type for the this field because is children of TextField. In this method self.escape is used for convert " to "
|
||||
"""
|
||||
|
||||
def __init__(self, name, required=False):
|
||||
|
|
@ -204,7 +204,14 @@ class HTMLField(TextField):
|
|||
if tag.name not in self.trusted_tags:
|
||||
tag.hidden=True
|
||||
|
||||
return soup.renderContents().decode('utf-8')
|
||||
value=soup.renderContents().decode('utf-8')
|
||||
|
||||
if self.escape:
|
||||
|
||||
return value.replace('"', '"')
|
||||
else:
|
||||
|
||||
return value
|
||||
|
||||
|
||||
class ForeignKeyField(IntegerField):
|
||||
|
|
@ -217,7 +224,7 @@ class ForeignKeyField(IntegerField):
|
|||
"""
|
||||
Args:
|
||||
name (str): Name of field
|
||||
related_table(str): The table related with this foreign key
|
||||
related_table(WebModel): The table-model related with this foreign key
|
||||
size (int): The size of the new field in database. By default 11.
|
||||
required (bool): Boolean for define if field is required or not
|
||||
identifier_field (str): The Id field name from related table
|
||||
|
|
@ -297,6 +304,7 @@ class BooleanField(IntegerField):
|
|||
if value<0 or value>1:
|
||||
self.txt_error=self.default_error
|
||||
self.error=True
|
||||
value=0
|
||||
|
||||
except:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue