0.10.2 mail alert by new routes

This commit is contained in:
SDE
2024-01-11 19:03:25 +03:00
parent ad909b98bf
commit 6c1011e59e
13 changed files with 267 additions and 22 deletions

View File

@@ -10,8 +10,15 @@ def get_options_by_opt_types(opt_types, only_vals=False):
opts = Option.objects.filter(**kwargs)
if opts and only_vals:
opts = opts.values('opt_type', 'value')
opts = {item['opt_type']: item['value'] for item in opts}
res = {}
opts = opts.values('opt_type', 'value', 'prefix')
for item in opts:
if item['prefix']:
res.update({item['opt_type']: f"{item['prefix']}{item['value']}"})
else:
res.update({item['opt_type']: f"{item['value']}"})
return res
return opts
def get_first_option_value_by_opt_type(opt_type):