diff --git a/ereuse_devicehub/inventory/forms.py b/ereuse_devicehub/inventory/forms.py index 5235c78e..6b3a7546 100644 --- a/ereuse_devicehub/inventory/forms.py +++ b/ereuse_devicehub/inventory/forms.py @@ -521,23 +521,23 @@ class NewDeviceForm(FlaskForm): error = ["Not a correct value"] is_valid = super().validate(extra_validators) - if self.weight.data and not (0.1 <= self.weight.data <= 5): - txt = ["Supported values between 0.1 and 5"] + if self.weight.data and not (0.1 <= self.weight.data): + txt = ["Supported values greater than 0.1"] self.weight.errors = txt is_valid = False - if self.height.data and not (0.1 <= self.height.data <= 5): - txt = ["Supported values between 0.1 and 5"] + if self.height.data and not (0.1 <= self.height.data): + txt = ["Supported values greater than 0.1"] self.height.errors = txt is_valid = False - if self.width.data and not (0.1 <= self.width.data <= 5): - txt = ["Supported values between 0.1 and 5"] + if self.width.data and not (0.1 <= self.width.data): + txt = ["Supported values greater than 0.1"] self.width.errors = txt is_valid = False - if self.depth.data and not (0.1 <= self.depth.data <= 5): - txt = ["Supported values between 0.1 and 5"] + if self.depth.data and not (0.1 <= self.depth.data): + txt = ["Supported values greater than 0.1"] self.depth.errors = txt is_valid = False diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py index 0505a2f6..89b01c0c 100644 --- a/ereuse_devicehub/resources/device/models.py +++ b/ereuse_devicehub/resources/device/models.py @@ -150,13 +150,13 @@ class Device(Thing): generation.comment = """The generation of the device.""" version = db.Column(db.CIText()) version.comment = """The version code of this device, like v1 or A001.""" - weight = Column(Float(decimal_return_scale=4), check_range('weight', 0.1, 5)) + weight = Column(Float(decimal_return_scale=4)) weight.comment = """The weight of the device in Kg.""" - width = Column(Float(decimal_return_scale=4), check_range('width', 0.1, 5)) + width = Column(Float(decimal_return_scale=4)) width.comment = """The width of the device in meters.""" - height = Column(Float(decimal_return_scale=4), check_range('height', 0.1, 5)) + height = Column(Float(decimal_return_scale=4)) height.comment = """The height of the device in meters.""" - depth = Column(Float(decimal_return_scale=4), check_range('depth', 0.1, 5)) + depth = Column(Float(decimal_return_scale=4)) depth.comment = """The depth of the device in meters.""" color = Column(ColorType) color.comment = """The predominant color of the device.""" diff --git a/ereuse_devicehub/resources/device/schemas.py b/ereuse_devicehub/resources/device/schemas.py index 7d168a03..e3fe6485 100644 --- a/ereuse_devicehub/resources/device/schemas.py +++ b/ereuse_devicehub/resources/device/schemas.py @@ -67,18 +67,10 @@ class Device(Thing): validate=Range(1, 100), description=m.Device.generation.comment ) version = SanitizedStr(description=m.Device.version) - weight = Float( - validate=Range(0.1, 5), unit=UnitCodes.kgm, description=m.Device.weight.comment - ) - width = Float( - validate=Range(0.1, 5), unit=UnitCodes.m, description=m.Device.width.comment - ) - height = Float( - validate=Range(0.1, 5), unit=UnitCodes.m, description=m.Device.height.comment - ) - depth = Float( - validate=Range(0.1, 5), unit=UnitCodes.m, description=m.Device.depth.comment - ) + weight = Float(unit=UnitCodes.kgm, description=m.Device.weight.comment) + width = Float(unit=UnitCodes.m, description=m.Device.width.comment) + height = Float(unit=UnitCodes.m, description=m.Device.height.comment) + depth = Float(unit=UnitCodes.m, description=m.Device.depth.comment) # TODO TimeOut 2. Comment actions and lots if there are time out. actions = NestedOn( 'Action', many=True, dump_only=True, description=m.Device.actions.__doc__