From b5170a7c64af5b1f61899397f84c599bd614a329 Mon Sep 17 00:00:00 2001 From: esensar Date: Wed, 19 Sep 2018 22:13:14 +0200 Subject: [PATCH] Add ability to set device type when creating devices --- app/api/resources/device.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/api/resources/device.py b/app/api/resources/device.py index 67fe3cb..03d0731 100644 --- a/app/api/resources/device.py +++ b/app/api/resources/device.py @@ -15,6 +15,7 @@ class DeviceSchema(Schema): id = fields.Integer(dump_only=True) name = fields.Str(required=True) device_type = fields.Nested(DeviceTypeSchema, dump_only=True) + device_type_id = fields.Integer(load_only=True, missing=1) class DeviceWrapperSchema(Schema): @@ -96,7 +97,8 @@ class DeviceListResource(ProtectedResource): args = args['device'] success = devices.create_device( args['name'], - g.current_account.id) + g.current_account.id, + args['device_type_id']) if success: return '', 201