Add ability to set device type when creating devices

master
esensar 2018-09-19 22:13:14 +02:00
parent 7bc0dbb855
commit b5170a7c64
1 changed files with 3 additions and 1 deletions

View File

@ -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