add actions in placeholder model

This commit is contained in:
Cayo Puigdefabregas 2022-08-11 10:21:45 +02:00
parent 7ed2368f02
commit 57ba86eb39
1 changed files with 11 additions and 0 deletions

View File

@ -924,6 +924,17 @@ class Placeholder(Thing):
)
owner = db.relationship(User, primaryjoin=owner_id == User.id)
@property
def actions(self):
actions = list(self.device.actions) or []
if self.binding:
actions.extend(list(self.binding.actions))
actions = sorted(actions, key=lambda x: x.created)
actions.reverse()
return actions
class Computer(Device):
"""A chassis with components inside that can be processed