From 3edbe96968e521be9fd9ca49011e4b284c7bed61 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 9 Aug 2022 14:37:08 -0500 Subject: [PATCH] Some API tweaks to support a byjove app --- tailbone/api/auth.py | 10 ++++++++++ tailbone/api/customers.py | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tailbone/api/auth.py b/tailbone/api/auth.py index c4d04b90..584f397e 100644 --- a/tailbone/api/auth.py +++ b/tailbone/api/auth.py @@ -57,6 +57,16 @@ class AuthenticationView(APIView): data['background_color'] = self.rattail_config.get( '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 @api diff --git a/tailbone/api/customers.py b/tailbone/api/customers.py index fdd2c18e..9a06caaa 100644 --- a/tailbone/api/customers.py +++ b/tailbone/api/customers.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2020 Lance Edgar +# Copyright © 2010-2022 Lance Edgar # # This file is part of Rattail. # @@ -40,6 +40,8 @@ class CustomerView(APIMasterView): model_class = model.Customer collection_url_prefix = '/customers' object_url_prefix = '/customer' + supports_autocomplete = True + autocomplete_fieldname = 'name' def normalize(self, customer): return {