From 95a8b13a6b3f012ad9b64dc87f25f36a94ee3bc4 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 4 Mar 2022 13:00:51 +0100 Subject: [PATCH] form select type of device in the list of device. Step 1 --- ereuse_devicehub/inventory/views.py | 8 +++++++- ereuse_devicehub/templates/inventory/device_list.html | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index 62cd97cb..2329fa22 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -42,7 +42,13 @@ class DeviceListMix(View): def get_context(self, lot_id): # TODO @cayop adding filter # https://github.com/eReuse/devicehub-teal/blob/testing/ereuse_devicehub/resources/device/views.py#L56 - filter_types = ['Desktop', 'Laptop', 'Server'] + import pdb; pdb.set_trace() + type_device = { + None: ['Desktop', 'Laptop', 'Server'], + 'Computer': ['Computer'], + 'Monitor': ['Monitor'], + } + filter_types = type_device[request.get('filter')] lots = Lot.query.outerjoin(Trade) \ .filter(or_(Trade.user_from == g.user, Trade.user_to == g.user, diff --git a/ereuse_devicehub/templates/inventory/device_list.html b/ereuse_devicehub/templates/inventory/device_list.html index 63395f5a..4170318d 100644 --- a/ereuse_devicehub/templates/inventory/device_list.html +++ b/ereuse_devicehub/templates/inventory/device_list.html @@ -279,10 +279,17 @@
Computers
+
+ + +
- +
Select allSelect Title DHID Tags