add placeholder datastorage
This commit is contained in:
parent
6aa643c197
commit
57882ca2c5
|
@ -402,7 +402,7 @@ class NewDeviceForm(FlaskForm):
|
|||
sku = StringField('SKU', [validators.Optional()])
|
||||
image = URLField('Image', [validators.Optional(), validators.URL()])
|
||||
imei = IntegerField('IMEI', [validators.Optional()])
|
||||
data_storage_size = IntegerField('Storage Size', [validators.Optional()])
|
||||
data_storage_size = FloatField('Storage Size', [validators.Optional()])
|
||||
meid = StringField('MEID', [validators.Optional()])
|
||||
resolution = IntegerField('Resolution width', [validators.Optional()])
|
||||
screen = FloatField('Screen size', [validators.Optional()])
|
||||
|
@ -435,7 +435,7 @@ class NewDeviceForm(FlaskForm):
|
|||
"Other": Other,
|
||||
}
|
||||
|
||||
def reset_from_obj(self):
|
||||
def reset_from_obj(self): # noqa: C901
|
||||
if not self._obj:
|
||||
return
|
||||
disabled = {'disabled': "disabled"}
|
||||
|
@ -476,6 +476,9 @@ class NewDeviceForm(FlaskForm):
|
|||
if self._obj.type == 'ComputerMonitor':
|
||||
self.resolution.data = self._obj.resolution_width
|
||||
self.screen.data = self._obj.size
|
||||
if self._obj.type in ['HardDrive', 'SolidStateDrive']:
|
||||
if self._obj.size:
|
||||
self.data_storage_size.data = self._obj.size / 1000
|
||||
|
||||
if self._obj.placeholder.is_abstract:
|
||||
self.type.render_kw = disabled
|
||||
|
@ -501,6 +504,8 @@ class NewDeviceForm(FlaskForm):
|
|||
self.imei.render_kw = disabled
|
||||
self.meid.render_kw = disabled
|
||||
self.data_storage_size.render_kw = disabled
|
||||
if self._obj.type in ['HardDrive', 'SolidStateDrive']:
|
||||
self.data_storage_size.render_kw = disabled
|
||||
if self._obj.type == 'ComputerMonitor':
|
||||
self.resolution.render_kw = disabled
|
||||
self.screen.render_kw = disabled
|
||||
|
@ -570,7 +575,6 @@ class NewDeviceForm(FlaskForm):
|
|||
|
||||
if commit:
|
||||
db.session.commit()
|
||||
# import pdb; pdb.set_trace()
|
||||
|
||||
def create_device(self):
|
||||
schema = SnapshotSchema()
|
||||
|
@ -617,7 +621,8 @@ class NewDeviceForm(FlaskForm):
|
|||
device.data_storage_size = self.data_storage_size.data
|
||||
|
||||
if self.type.data in ['HardDrive', 'SolidStateDrive']:
|
||||
device.data_storage_size = self.data_storage_size.data
|
||||
if self.data_storage_size.data:
|
||||
self._obj.size = self.data_storage_size.data * 1000
|
||||
|
||||
device.image = URL(self.image.data)
|
||||
|
||||
|
@ -688,6 +693,10 @@ class NewDeviceForm(FlaskForm):
|
|||
self._obj.meid = self.meid.data
|
||||
self._obj.data_storage_size = self.data_storage_size.data
|
||||
|
||||
if self.type.data in ['HardDrive', 'SolidStateDrive']:
|
||||
if self.data_storage_size.data:
|
||||
self._obj.size = self.data_storage_size.data * 1000
|
||||
|
||||
if (
|
||||
self.appearance.data
|
||||
and self.appearance.data != self._obj.appearance().name
|
||||
|
|
|
@ -334,7 +334,7 @@
|
|||
<tr style="border-bottom: 1px dashed #000;">
|
||||
{% if erasure.device.is_mobile() %}
|
||||
<td>
|
||||
{{ (erasure.device.imei or '') }}
|
||||
IMEI:{{ (erasure.device.imei or '') }}
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
|
@ -376,7 +376,7 @@
|
|||
<dd>Model: {{ erasure.device.model }}</dd>
|
||||
<dd>IMEI: {{ (erasure.device.imei or '') }}</dd>
|
||||
<dd>DHID: {{ erasure.device.dhid }}</dd>
|
||||
<dd>Size: {{ erasure.device.get_size() or '' }}</dd>
|
||||
<dd>Size: {{ erasure.device.get_size() or '?' }} GB</dd>
|
||||
{% else %}
|
||||
<h4>{{ (erasure.device.serial_number or '').upper() }}</h4>
|
||||
<dl>
|
||||
|
|
Reference in New Issue