drop enconded as unicode
This commit is contained in:
parent
4ce359fec4
commit
96a240b3cd
|
@ -32,8 +32,8 @@ from ereuse_devicehub.resources.user.exceptions import InsufficientPermission
|
||||||
|
|
||||||
|
|
||||||
class LotDeviceForm(FlaskForm):
|
class LotDeviceForm(FlaskForm):
|
||||||
lot = StringField(u'Lot', [validators.UUID()])
|
lot = StringField('Lot', [validators.UUID()])
|
||||||
devices = StringField(u'Devices', [validators.length(min=1)])
|
devices = StringField('Devices', [validators.length(min=1)])
|
||||||
|
|
||||||
def validate(self, extra_validators=None):
|
def validate(self, extra_validators=None):
|
||||||
is_valid = super().validate(extra_validators)
|
is_valid = super().validate(extra_validators)
|
||||||
|
@ -68,7 +68,7 @@ class LotDeviceForm(FlaskForm):
|
||||||
|
|
||||||
|
|
||||||
class LotForm(FlaskForm):
|
class LotForm(FlaskForm):
|
||||||
name = StringField(u'Name', [validators.length(min=1)])
|
name = StringField('Name', [validators.length(min=1)])
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.id = kwargs.pop('id', None)
|
self.id = kwargs.pop('id', None)
|
||||||
|
@ -103,7 +103,7 @@ class LotForm(FlaskForm):
|
||||||
|
|
||||||
|
|
||||||
class UploadSnapshotForm(FlaskForm):
|
class UploadSnapshotForm(FlaskForm):
|
||||||
snapshot = MultipleFileField(u'Select a Snapshot File', [validators.DataRequired()])
|
snapshot = MultipleFileField('Select a Snapshot File', [validators.DataRequired()])
|
||||||
|
|
||||||
def validate(self, extra_validators=None):
|
def validate(self, extra_validators=None):
|
||||||
is_valid = super().validate(extra_validators)
|
is_valid = super().validate(extra_validators)
|
||||||
|
@ -227,27 +227,27 @@ class UploadSnapshotForm(FlaskForm):
|
||||||
|
|
||||||
|
|
||||||
class NewDeviceForm(FlaskForm):
|
class NewDeviceForm(FlaskForm):
|
||||||
type = StringField(u'Type', [validators.DataRequired()])
|
type = StringField('Type', [validators.DataRequired()])
|
||||||
label = StringField(u'Label')
|
label = StringField('Label')
|
||||||
serial_number = StringField(u'Seria Number', [validators.DataRequired()])
|
serial_number = StringField('Seria Number', [validators.DataRequired()])
|
||||||
model = StringField(u'Model', [validators.DataRequired()])
|
model = StringField('Model', [validators.DataRequired()])
|
||||||
manufacturer = StringField(u'Manufacturer', [validators.DataRequired()])
|
manufacturer = StringField('Manufacturer', [validators.DataRequired()])
|
||||||
appearance = StringField(u'Appearance', [validators.Optional()])
|
appearance = StringField('Appearance', [validators.Optional()])
|
||||||
functionality = StringField(u'Functionality', [validators.Optional()])
|
functionality = StringField('Functionality', [validators.Optional()])
|
||||||
brand = StringField(u'Brand')
|
brand = StringField('Brand')
|
||||||
generation = IntegerField(u'Generation')
|
generation = IntegerField('Generation')
|
||||||
version = StringField(u'Version')
|
version = StringField('Version')
|
||||||
weight = FloatField(u'Weight', [validators.DataRequired()])
|
weight = FloatField('Weight', [validators.DataRequired()])
|
||||||
width = FloatField(u'Width', [validators.DataRequired()])
|
width = FloatField('Width', [validators.DataRequired()])
|
||||||
height = FloatField(u'Height', [validators.DataRequired()])
|
height = FloatField('Height', [validators.DataRequired()])
|
||||||
depth = FloatField(u'Depth', [validators.DataRequired()])
|
depth = FloatField('Depth', [validators.DataRequired()])
|
||||||
variant = StringField(u'Variant', [validators.Optional()])
|
variant = StringField('Variant', [validators.Optional()])
|
||||||
sku = StringField(u'SKU', [validators.Optional()])
|
sku = StringField('SKU', [validators.Optional()])
|
||||||
image = StringField(u'Image', [validators.Optional(), validators.URL()])
|
image = StringField('Image', [validators.Optional(), validators.URL()])
|
||||||
imei = IntegerField(u'IMEI', [validators.Optional()])
|
imei = IntegerField('IMEI', [validators.Optional()])
|
||||||
meid = StringField(u'MEID', [validators.Optional()])
|
meid = StringField('MEID', [validators.Optional()])
|
||||||
resolution = IntegerField(u'Resolution width', [validators.Optional()])
|
resolution = IntegerField('Resolution width', [validators.Optional()])
|
||||||
screen = FloatField(u'Screen size', [validators.Optional()])
|
screen = FloatField('Screen size', [validators.Optional()])
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
@ -387,7 +387,7 @@ class NewDeviceForm(FlaskForm):
|
||||||
|
|
||||||
|
|
||||||
class TagForm(FlaskForm):
|
class TagForm(FlaskForm):
|
||||||
code = StringField(u'Code', [validators.length(min=1)])
|
code = StringField('Code', [validators.length(min=1)])
|
||||||
|
|
||||||
def validate(self, extra_validators=None):
|
def validate(self, extra_validators=None):
|
||||||
error = ["This value is being used"]
|
error = ["This value is being used"]
|
||||||
|
@ -415,7 +415,7 @@ class TagForm(FlaskForm):
|
||||||
|
|
||||||
|
|
||||||
class TagUnnamedForm(FlaskForm):
|
class TagUnnamedForm(FlaskForm):
|
||||||
amount = IntegerField(u'amount')
|
amount = IntegerField('amount')
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
num = self.amount.data
|
num = self.amount.data
|
||||||
|
@ -427,8 +427,8 @@ class TagUnnamedForm(FlaskForm):
|
||||||
|
|
||||||
|
|
||||||
class TagDeviceForm(FlaskForm):
|
class TagDeviceForm(FlaskForm):
|
||||||
tag = SelectField(u'Tag', choices=[])
|
tag = SelectField('Tag', choices=[])
|
||||||
device = StringField(u'Device', [validators.Optional()])
|
device = StringField('Device', [validators.Optional()])
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.delete = kwargs.pop('delete', None)
|
self.delete = kwargs.pop('delete', None)
|
||||||
|
@ -481,19 +481,19 @@ class TagDeviceForm(FlaskForm):
|
||||||
|
|
||||||
|
|
||||||
class NewActionForm(FlaskForm):
|
class NewActionForm(FlaskForm):
|
||||||
name = StringField(u'Name', [validators.length(max=50)],
|
name = StringField('Name', [validators.length(max=50)],
|
||||||
description="A name or title of the event. Something to look for.")
|
description="A name or title of the event. Something to look for.")
|
||||||
devices = HiddenField()
|
devices = HiddenField()
|
||||||
date = DateField(u'Date', [validators.Optional()],
|
date = DateField('Date', [validators.Optional()],
|
||||||
description="""When the action ends. For some actions like booking
|
description="""When the action ends. For some actions like booking
|
||||||
the time when it expires, for others like renting the
|
the time when it expires, for others like renting the
|
||||||
time that the end rents. For specific actions, it is the
|
time that the end rents. For specific actions, it is the
|
||||||
time in which they are carried out; differs from created
|
time in which they are carried out; differs from created
|
||||||
in that created is where the system receives the action.""")
|
in that created is where the system receives the action.""")
|
||||||
severity = SelectField(u'Severity', choices=[(v.name, v.name) for v in Severity],
|
severity = SelectField('Severity', choices=[(v.name, v.name) for v in Severity],
|
||||||
description="""An indicator that evaluates the execution of the event.
|
description="""An indicator that evaluates the execution of the event.
|
||||||
For example, failed events are set to Error""")
|
For example, failed events are set to Error""")
|
||||||
description = TextAreaField(u'Description')
|
description = TextAreaField('Description')
|
||||||
lot = HiddenField()
|
lot = HiddenField()
|
||||||
type = HiddenField()
|
type = HiddenField()
|
||||||
|
|
||||||
|
@ -544,11 +544,11 @@ class NewActionForm(FlaskForm):
|
||||||
|
|
||||||
|
|
||||||
class AllocateForm(NewActionForm):
|
class AllocateForm(NewActionForm):
|
||||||
start_time = DateField(u'Start time')
|
start_time = DateField('Start time')
|
||||||
end_time = DateField(u'End time')
|
end_time = DateField('End time')
|
||||||
final_user_code = StringField(u'Final user code', [validators.length(max=50)])
|
final_user_code = StringField('Final user code', [validators.length(max=50)])
|
||||||
transaction = StringField(u'Transaction', [validators.length(max=50)])
|
transaction = StringField('Transaction', [validators.length(max=50)])
|
||||||
end_users = IntegerField(u'End users')
|
end_users = IntegerField('End users')
|
||||||
|
|
||||||
def validate(self, extra_validators=None):
|
def validate(self, extra_validators=None):
|
||||||
is_valid = super().validate(extra_validators)
|
is_valid = super().validate(extra_validators)
|
||||||
|
@ -569,17 +569,17 @@ class AllocateForm(NewActionForm):
|
||||||
|
|
||||||
|
|
||||||
class DataWipeDocumentForm(Form):
|
class DataWipeDocumentForm(Form):
|
||||||
date = DateField(u'Date', [validators.Optional()],
|
date = DateField('Date', [validators.Optional()],
|
||||||
description="Date when was data wipe")
|
description="Date when was data wipe")
|
||||||
url = URLField(u'Url', [validators.Optional()],
|
url = URLField('Url', [validators.Optional()],
|
||||||
description="Url where the document resides")
|
description="Url where the document resides")
|
||||||
success = BooleanField(u'Success', [validators.Optional()],
|
success = BooleanField('Success', [validators.Optional()],
|
||||||
description="The erase was success or not?")
|
description="The erase was success or not?")
|
||||||
software = StringField(u'Software', [validators.Optional()],
|
software = StringField('Software', [validators.Optional()],
|
||||||
description="Which software has you use for erase the disks")
|
description="Which software has you use for erase the disks")
|
||||||
id_document = StringField(u'Document Id', [validators.Optional()],
|
id_document = StringField('Document Id', [validators.Optional()],
|
||||||
description="Identification number of document")
|
description="Identification number of document")
|
||||||
file_name = FileField(u'File', [validators.DataRequired()],
|
file_name = FileField('File', [validators.DataRequired()],
|
||||||
description="""This file is not stored on our servers, it is only used to
|
description="""This file is not stored on our servers, it is only used to
|
||||||
generate a digital signature and obtain the name of the file.""")
|
generate a digital signature and obtain the name of the file.""")
|
||||||
|
|
||||||
|
@ -637,16 +637,16 @@ class DataWipeForm(NewActionForm):
|
||||||
|
|
||||||
|
|
||||||
class TradeForm(NewActionForm):
|
class TradeForm(NewActionForm):
|
||||||
user_from = StringField(u'Supplier', [validators.Optional()],
|
user_from = StringField('Supplier', [validators.Optional()],
|
||||||
description="Please enter the supplier's email address",
|
description="Please enter the supplier's email address",
|
||||||
render_kw={'data-email': ""})
|
render_kw={'data-email': ""})
|
||||||
user_to = StringField(u'Receiver', [validators.Optional()],
|
user_to = StringField('Receiver', [validators.Optional()],
|
||||||
description="Please enter the receiver's email address",
|
description="Please enter the receiver's email address",
|
||||||
render_kw={'data-email': ""})
|
render_kw={'data-email': ""})
|
||||||
confirm = BooleanField(u'Confirm', [validators.Optional()],
|
confirm = BooleanField('Confirm', [validators.Optional()],
|
||||||
default=True,
|
default=True,
|
||||||
description="I need confirmation from the other user for every device and document.")
|
description="I need confirmation from the other user for every device and document.")
|
||||||
code = StringField(u'Code', [validators.Optional()],
|
code = StringField('Code', [validators.Optional()],
|
||||||
description="If you don't need confirm, you need put a code for trace the user in the statistics.")
|
description="If you don't need confirm, you need put a code for trace the user in the statistics.")
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -774,19 +774,19 @@ class TradeForm(NewActionForm):
|
||||||
|
|
||||||
|
|
||||||
class TradeDocumentForm(FlaskForm):
|
class TradeDocumentForm(FlaskForm):
|
||||||
url = URLField(u'Url', [validators.Optional()],
|
url = URLField('Url', [validators.Optional()],
|
||||||
render_kw={'class': "form-control"},
|
render_kw={'class': "form-control"},
|
||||||
description="Url where the document resides")
|
description="Url where the document resides")
|
||||||
description = StringField(u'Description', [validators.Optional()],
|
description = StringField('Description', [validators.Optional()],
|
||||||
render_kw={'class': "form-control"},
|
render_kw={'class': "form-control"},
|
||||||
description="")
|
description="")
|
||||||
id_document = StringField(u'Document Id', [validators.Optional()],
|
id_document = StringField('Document Id', [validators.Optional()],
|
||||||
render_kw={'class': "form-control"},
|
render_kw={'class': "form-control"},
|
||||||
description="Identification number of document")
|
description="Identification number of document")
|
||||||
date = DateField(u'Date', [validators.Optional()],
|
date = DateField('Date', [validators.Optional()],
|
||||||
render_kw={'class': "form-control"},
|
render_kw={'class': "form-control"},
|
||||||
description="")
|
description="")
|
||||||
file_name = FileField(u'File', [validators.DataRequired()],
|
file_name = FileField('File', [validators.DataRequired()],
|
||||||
render_kw={'class': "form-control"},
|
render_kw={'class': "form-control"},
|
||||||
description="""This file is not stored on our servers, it is only used to
|
description="""This file is not stored on our servers, it is only used to
|
||||||
generate a digital signature and obtain the name of the file.""")
|
generate a digital signature and obtain the name of the file.""")
|
||||||
|
|
Reference in New Issue