fixing bug

This commit is contained in:
Cayo Puigdefabregas 2021-10-01 10:46:08 +02:00
parent eeb6db7bc2
commit 6599f4b66c
2 changed files with 12 additions and 2 deletions

View File

@ -12,7 +12,7 @@ from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'a0978ac6cf4a'
down_revision = '7ecb8ff7abad'
down_revision = '3ac2bc1897ce'
branch_labels = None
depends_on = None

View File

@ -424,14 +424,24 @@ class Ready(ActionWithMultipleDevices):
__doc__ = m.Ready.__doc__
class ActionStatus(ActionWithMultipleDevices):
class ActionStatus(Action):
rol_user = NestedOn(s_user.User, dump_only=True, exclude=('token',))
devices = NestedOn(s_device.Device,
many=True,
required=False, # todo test ensuring len(devices) >= 1
only_query='id',
collection_class=OrderedSet)
documents = NestedOn(s_document.TradeDocument,
many=True,
required=False, # todo test ensuring len(devices) >= 1
only_query='id',
collection_class=OrderedSet)
@pre_load
def put_devices(self, data: dict):
if not 'devices' in data.keys():
data['devices'] = []
@post_load
def put_rol_user(self, data: dict):
for dev in data['devices']: