add device placeholder only in the list of devices
This commit is contained in:
parent
1fa6e7512c
commit
03fbfcb73b
|
@ -136,9 +136,13 @@ class FilterForm(FlaskForm):
|
||||||
if self.lot_id:
|
if self.lot_id:
|
||||||
self.lot = self.lots.filter(Lot.id == self.lot_id).one()
|
self.lot = self.lots.filter(Lot.id == self.lot_id).one()
|
||||||
device_ids = (d.id for d in self.lot.devices)
|
device_ids = (d.id for d in self.lot.devices)
|
||||||
self.devices = Device.query.filter(Device.id.in_(device_ids))
|
self.devices = Device.query.filter(Device.id.in_(device_ids)).filter(
|
||||||
|
Device.binding == None
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
self.devices = Device.query.filter(Device.owner_id == g.user.id)
|
self.devices = Device.query.filter(Device.owner_id == g.user.id).filter(
|
||||||
|
Device.binding == None
|
||||||
|
)
|
||||||
if self.only_unassigned:
|
if self.only_unassigned:
|
||||||
self.devices = self.devices.filter_by(lots=None)
|
self.devices = self.devices.filter_by(lots=None)
|
||||||
|
|
||||||
|
|
Reference in New Issue