Fix searching for IDs, numbers, HP, and Asus
This commit is contained in:
parent
2d525231c3
commit
3962dfe3b8
|
@ -88,7 +88,20 @@ class DeviceView(View):
|
||||||
200:
|
200:
|
||||||
description: The device or devices.
|
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):
|
def one(self, id: int):
|
||||||
"""Gets one device."""
|
"""Gets one device."""
|
||||||
|
|
Reference in a new issue