From c0558733ecf8b5dae4f37eb4d86063d00fbecc3f Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 9 Jun 2021 11:36:11 +0200 Subject: [PATCH] fixing remove decvices from a temporary lot --- ereuse_devicehub/resources/lot/views.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ereuse_devicehub/resources/lot/views.py b/ereuse_devicehub/resources/lot/views.py index 484d9c3a..6208d261 100644 --- a/ereuse_devicehub/resources/lot/views.py +++ b/ereuse_devicehub/resources/lot/views.py @@ -255,11 +255,13 @@ class LotDeviceView(LotBaseChildrenView): if lot.trade: return delete_from_trade(lot, ids) - if not g.user in lot.owner: - txt = 'This is not your trade' + # import pdb; pdb.set_trace() + if not g.user == lot.owner: + txt = 'This is not your lot' raise ma.ValidationError(txt) + devices = set(Device.query.filter(Device.id.in_(ids)).filter( - Device.owner_id.in_(g.user.id))) + Device.owner_id == g.user.id)) lot.devices.difference_update(devices)