Merge pull request #345 from eReuse/changes/3742-remove-generation

remove generation concept in form create device
This commit is contained in:
cayop 2022-09-14 18:36:40 +02:00 committed by GitHub
commit c45e0c969f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 25 deletions

View File

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

View File

@ -294,19 +294,6 @@
{% endif %} {% endif %}
</div> </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"> <div class="from-group has-validation mb-2">
<label for="model" class="form-label">{{ form.version.label }}</label> <label for="model" class="form-label">{{ form.version.label }}</label>
{{ form.version(class_="form-control") }} {{ form.version(class_="form-control") }}