remove generation concept in form create device

This commit is contained in:
Cayo Puigdefabregas 2022-09-14 18:09:44 +02:00
parent 07c641f4b9
commit cf0cd9faa0
2 changed files with 0 additions and 25 deletions

View File

@ -333,7 +333,6 @@ class NewDeviceForm(FlaskForm):
appearance = StringField('Appearance', [validators.Optional()])
functionality = StringField('Functionality', [validators.Optional()])
brand = StringField('Brand')
generation = IntegerField('Generation')
version = StringField('Version')
weight = FloatField('Weight', [validators.Optional()])
width = FloatField('Width', [validators.Optional()])
@ -369,9 +368,6 @@ class NewDeviceForm(FlaskForm):
"MemoryCardReader": MemoryCardReader,
}
if not self.generation.data:
self.generation.data = 1
def reset_from_obj(self):
if not self._obj:
return
@ -397,7 +393,6 @@ class NewDeviceForm(FlaskForm):
self.appearance.data = appearance
self.functionality.data = functionality
self.brand.data = self._obj.brand
self.generation.data = self._obj.generation
self.version.data = self._obj.version
self.weight.data = self._obj.weight
self.width.data = self._obj.width
@ -427,7 +422,6 @@ class NewDeviceForm(FlaskForm):
self.appearance.render_kw = disabled
self.functionality.render_kw = disabled
self.brand.render_kw = disabled
self.generation.render_kw = disabled
self.version.render_kw = disabled
self.weight.render_kw = disabled
self.width.render_kw = disabled
@ -447,10 +441,6 @@ class NewDeviceForm(FlaskForm):
error = ["Not a correct value"]
is_valid = super().validate(extra_validators)
if self.generation.data and self.generation.data < 1:
self.generation.errors = error
is_valid = False
if self.weight.data and not (0.1 <= self.weight.data <= 5):
txt = ["Supported values between 0.1 and 5"]
self.weight.errors = txt
@ -549,7 +539,6 @@ class NewDeviceForm(FlaskForm):
'partNumber': self.part_number.data,
'brand': self.brand.data,
'version': self.version.data,
'generation': self.generation.data,
'sku': self.sku.data,
'weight': self.weight.data,
'width': self.width.data,
@ -626,7 +615,6 @@ class NewDeviceForm(FlaskForm):
self._obj.part_number = self.part_number.data
self._obj.brand = self.brand.data
self._obj.version = self.version.data
self._obj.generation = self.generation.data
self._obj.sku = self.sku.data
self._obj.weight = self.weight.data
self._obj.width = self.width.data

View File

@ -294,19 +294,6 @@
{% endif %}
</div>
<div class="from-group has-validation mb-2">
<label for="model" class="form-label">{{ form.generation.label }}</label>
{{ form.generation(class_="form-control") }}
<small class="text-muted form-text">The generation of the device.</small>
{% if form.generation.errors %}
<p class="text-danger">
{% for error in form.generation.errors %}
{{ error }}<br/>
{% endfor %}
</p>
{% endif %}
</div>
<div class="from-group has-validation mb-2">
<label for="model" class="form-label">{{ form.version.label }}</label>
{{ form.version(class_="form-control") }}