From 8e12c7e515ffbc5554b4fb8dfc4276fabac2aa7a Mon Sep 17 00:00:00 2001 From: SDE Date: Fri, 19 Jul 2024 01:24:18 +0300 Subject: [PATCH] 0.5.21 fix get_options_by_opt_types --- GeneralApp/funcs_options.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/GeneralApp/funcs_options.py b/GeneralApp/funcs_options.py index 4d05417..295ecec 100644 --- a/GeneralApp/funcs_options.py +++ b/GeneralApp/funcs_options.py @@ -11,10 +11,14 @@ def get_options_by_opt_types(opt_types, only_vals=False, w_prefix=False): opts = Option.objects.filter(**kwargs) if opts and only_vals: opts = opts.values('opt_type', 'value', 'prefix') - if w_prefix: - opts = {item['opt_type']: f"{item['prefix']}{item['value']}" for item in opts} - else: - opts = {item['opt_type']: item['value'] for item in opts} + res_Dict = {} + for item in opts: + val = item['value'] + if w_prefix: + val = item['prefix'] + val + res_Dict.update({item['opt_type']: val}) + return res_Dict + return opts def get_first_option_value_by_opt_type(opt_type):