Add new "master" API view class; refactor products and batches to use it
This commit is contained in:
parent
df00dd600a
commit
113c0af49d
8 changed files with 183 additions and 90 deletions
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2019 Lance Edgar
|
||||
# Copyright © 2010-2020 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -81,7 +81,7 @@ class APIMasterView(APIView):
|
|||
Returns a prefix which (by default) applies to all permissions
|
||||
leveraged by this view class.
|
||||
"""
|
||||
prefix = getattr(cls, 'permission_prefix')
|
||||
prefix = getattr(cls, 'permission_prefix', None)
|
||||
if prefix:
|
||||
return prefix
|
||||
return cls.get_route_prefix()
|
||||
|
@ -371,6 +371,10 @@ class APIMasterView(APIView):
|
|||
##############################
|
||||
|
||||
def autocomplete(self):
|
||||
"""
|
||||
View which accepts a single ``term`` param, and returns a list of
|
||||
autocomplete results to match.
|
||||
"""
|
||||
term = self.request.params.get('term', '').strip()
|
||||
term = self.prepare_autocomplete_term(term)
|
||||
if not term:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue