This commit is contained in:
Cayo Puigdefabregas 2022-03-08 10:30:53 +01:00
parent 70f093e1a1
commit ea66c31a07
1 changed files with 13 additions and 5 deletions

View File

@ -98,14 +98,22 @@ class FilterForm(FlaskForm):
filter = SelectField('', choices=DEVICES, default="Computer", filter = SelectField('', choices=DEVICES, default="Computer",
render_kw={'class': "form-select"}) render_kw={'class': "form-select"})
def search(self): def __init__(self, *args, **kwargs):
device = dict(DEVICES).get(request.args.get('filter')) 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'] return ['Desktop', 'Laptop', 'Server']
if device: if self.device == "DataStorage":
return [device] return ['HardDrive', 'SolidStateDrive']
if self.device:
return [self.device]
return ['Desktop', 'Laptop', 'Server'] return ['Desktop', 'Laptop', 'Server']