fixing remove decvices from a temporary lot

This commit is contained in:
Cayo Puigdefabregas 2021-06-09 11:36:11 +02:00
parent 0f744d5eb7
commit c0558733ec

View file

@ -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)