Fix searching for IDs, numbers, HP, and Asus

This commit is contained in:
Xavier Bustamante Talavera 2018-10-31 11:59:12 +01:00
parent 2d525231c3
commit 3962dfe3b8
1 changed files with 14 additions and 1 deletions

View File

@ -88,7 +88,20 @@ class DeviceView(View):
200:
description: The device or devices.
"""
return super().get(id)
# Majority of code is from teal
if id:
response = self.one(id)
else:
args = self.QUERY_PARSER.parse(self.find_args,
request,
locations=('querystring',))
# todo not-nice way of de-parsing what webargs parser
# does when sees that an argument is like an int, etc
# when solving this, change too the Query.search to Str
if args.get('search', False):
args['search'] = str(args['search'])
response = self.find(args)
return response
def one(self, id: int):
"""Gets one device."""