fix image in edit device

This commit is contained in:
Cayo Puigdefabregas 2022-10-25 17:54:58 +02:00
parent dfdbf8f1f7
commit 2a8da254d9
1 changed files with 3 additions and 3 deletions

View File

@ -353,7 +353,7 @@ class NewDeviceForm(FlaskForm):
depth = FloatField('Depth', [validators.Optional()]) depth = FloatField('Depth', [validators.Optional()])
variant = StringField('Variant', [validators.Optional()]) variant = StringField('Variant', [validators.Optional()])
sku = StringField('SKU', [validators.Optional()]) sku = StringField('SKU', [validators.Optional()])
image = StringField('Image', [validators.Optional(), validators.URL()]) image = URLField('Image', [validators.Optional(), validators.URL()])
imei = IntegerField('IMEI', [validators.Optional()]) imei = IntegerField('IMEI', [validators.Optional()])
meid = StringField('MEID', [validators.Optional()]) meid = StringField('MEID', [validators.Optional()])
resolution = IntegerField('Resolution width', [validators.Optional()]) resolution = IntegerField('Resolution width', [validators.Optional()])
@ -413,7 +413,7 @@ class NewDeviceForm(FlaskForm):
self.depth.data = self._obj.depth self.depth.data = self._obj.depth
self.variant.data = self._obj.variant self.variant.data = self._obj.variant
self.sku.data = self._obj.sku self.sku.data = self._obj.sku
self.image.data = self._obj.image self.image.data = self._obj.image.to_text()
if self._obj.type in ['Smartphone', 'Tablet', 'Cellphone']: if self._obj.type in ['Smartphone', 'Tablet', 'Cellphone']:
self.imei.data = self._obj.imei self.imei.data = self._obj.imei
self.meid.data = self._obj.meid self.meid.data = self._obj.meid
@ -614,7 +614,7 @@ class NewDeviceForm(FlaskForm):
self._obj.height = self.height.data self._obj.height = self.height.data
self._obj.depth = self.depth.data self._obj.depth = self.depth.data
self._obj.variant = self.variant.data self._obj.variant = self.variant.data
self._obj.image = self.image.data self._obj.image = URL(self.image.data)
if self._obj.type == 'ComputerMonitor': if self._obj.type == 'ComputerMonitor':
self._obj.resolution_width = self.resolution.data self._obj.resolution_width = self.resolution.data