fix render image None

This commit is contained in:
Cayo Puigdefabregas 2022-10-26 09:33:28 +02:00
parent 2a8da254d9
commit e30990cc1b
2 changed files with 6 additions and 2 deletions

View File

@ -413,7 +413,8 @@ class NewDeviceForm(FlaskForm):
self.depth.data = self._obj.depth
self.variant.data = self._obj.variant
self.sku.data = self._obj.sku
self.image.data = self._obj.image.to_text()
if self._obj.image:
self.image.data = self._obj.image.to_text()
if self._obj.type in ['Smartphone', 'Tablet', 'Cellphone']:
self.imei.data = self._obj.imei
self.meid.data = self._obj.meid
@ -559,6 +560,8 @@ class NewDeviceForm(FlaskForm):
device.imei = self.imei.data
device.meid = self.meid.data
device.image = URL(self.image.data)
device.placeholder = self.get_placeholder()
db.session.add(device)

View File

@ -2174,6 +2174,7 @@ def test_manual_binding(user3: UserClientFlask):
@pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)
def test_edit_and_binding(user3: UserClientFlask):
# TODO
uri = '/inventory/device/add/'
user3.get(uri)
@ -2587,7 +2588,7 @@ def test_system_uuid_motherboard(user3: UserClientFlask):
# we want to do an snapshot log when there are the same system-uuid for
# 2 computers with diferent motherboard
snapshot = create_device(user3, 'real-eee-1001pxd.snapshot.12.json')
device = snapshot.device
# device = snapshot.device
uri = '/inventory/upload-snapshot/'
file_name = 'real-eee-1001pxd.snapshot.12'