From 14d4d0aed0116d0bb4effce0d75c7dddf33da37d Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 16 Oct 2020 15:26:12 +0200 Subject: [PATCH] fixed view --- ereuse_devicehub/resources/action/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/resources/action/views.py b/ereuse_devicehub/resources/action/views.py index 6bdaa8f8..f96d50c7 100644 --- a/ereuse_devicehub/resources/action/views.py +++ b/ereuse_devicehub/resources/action/views.py @@ -70,8 +70,9 @@ class ActionView(View): return self.transfer_ownership() Model = db.Model._decl_class_registry.data[json['type']]() action = Model(**a) - for d in action.devices: - d.updated = datetime.now() + if hasattr(action, 'devices'): + for d in action.devices: + d.updated = datetime.now() db.session.add(action) db.session().final_flush() ret = self.schema.jsonify(action)