diff --git a/ereuse_devicehub/inventory/forms.py b/ereuse_devicehub/inventory/forms.py index 91b80305..fae58678 100644 --- a/ereuse_devicehub/inventory/forms.py +++ b/ereuse_devicehub/inventory/forms.py @@ -98,14 +98,22 @@ class FilterForm(FlaskForm): filter = SelectField('', choices=DEVICES, default="Computer", render_kw={'class': "form-select"}) - def search(self): - device = dict(DEVICES).get(request.args.get('filter')) + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.device = dict(DEVICES).get(request.args.get('filter')) + if self.device: + self.filter.data = self.device - if device == "Computer": + def search(self): + + if self.device == "Computer": return ['Desktop', 'Laptop', 'Server'] - if device: - return [device] + if self.device == "DataStorage": + return ['HardDrive', 'SolidStateDrive'] + + if self.device: + return [self.device] return ['Desktop', 'Laptop', 'Server']