Some API tweaks to support a byjove app

This commit is contained in:
Lance Edgar 2022-08-09 14:37:08 -05:00
parent d6aeb1d10f
commit 3edbe96968
2 changed files with 13 additions and 1 deletions

View file

@ -57,6 +57,16 @@ class AuthenticationView(APIView):
data['background_color'] = self.rattail_config.get( data['background_color'] = self.rattail_config.get(
'tailbone', 'background_color') 'tailbone', 'background_color')
# TODO: this seems the best place to return some global app
# settings, but maybe not desirable in all cases..in which
# case should caller need to ask for these explicitly? or
# make a different call altogether to get them..?
app = self.get_rattail_app()
customer_handler = app.get_clientele_handler()
data['settings'] = {
'customer_field_dropdown': customer_handler.choice_uses_dropdown(),
}
return data return data
@api @api

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# Rattail -- Retail Software Framework # Rattail -- Retail Software Framework
# Copyright © 2010-2020 Lance Edgar # Copyright © 2010-2022 Lance Edgar
# #
# This file is part of Rattail. # This file is part of Rattail.
# #
@ -40,6 +40,8 @@ class CustomerView(APIMasterView):
model_class = model.Customer model_class = model.Customer
collection_url_prefix = '/customers' collection_url_prefix = '/customers'
object_url_prefix = '/customer' object_url_prefix = '/customer'
supports_autocomplete = True
autocomplete_fieldname = 'name'
def normalize(self, customer): def normalize(self, customer):
return { return {