0.5.21 fix get_options_by_opt_types
This commit is contained in:
@@ -11,10 +11,14 @@ def get_options_by_opt_types(opt_types, only_vals=False, w_prefix=False):
|
|||||||
opts = Option.objects.filter(**kwargs)
|
opts = Option.objects.filter(**kwargs)
|
||||||
if opts and only_vals:
|
if opts and only_vals:
|
||||||
opts = opts.values('opt_type', 'value', 'prefix')
|
opts = opts.values('opt_type', 'value', 'prefix')
|
||||||
if w_prefix:
|
res_Dict = {}
|
||||||
opts = {item['opt_type']: f"{item['prefix']}{item['value']}" for item in opts}
|
for item in opts:
|
||||||
else:
|
val = item['value']
|
||||||
opts = {item['opt_type']: item['value'] for item in opts}
|
if w_prefix:
|
||||||
|
val = item['prefix'] + val
|
||||||
|
res_Dict.update({item['opt_type']: val})
|
||||||
|
return res_Dict
|
||||||
|
|
||||||
return opts
|
return opts
|
||||||
|
|
||||||
def get_first_option_value_by_opt_type(opt_type):
|
def get_first_option_value_by_opt_type(opt_type):
|
||||||
|
|||||||
Reference in New Issue
Block a user