backoffice: ignore empty items data in field filters (#38889)
This commit is contained in:
parent
4b8c74fd95
commit
09a29908f8
|
@ -930,6 +930,9 @@ def test_backoffice_items_filter(pub):
|
|||
elif i%4 == 2:
|
||||
formdata.data['4'] = ['â']
|
||||
formdata.data['4_display'] = 'â'
|
||||
else:
|
||||
formdata.data['4'] = []
|
||||
formdata.data['4_display'] = None
|
||||
formdata.store()
|
||||
|
||||
app = login(get_app(pub))
|
||||
|
|
|
@ -1080,8 +1080,9 @@ class FormPage(Directory):
|
|||
# unnest key/values
|
||||
exploded_options = {}
|
||||
for option_keys, option_label in options:
|
||||
for option_key, option_label in zip(option_keys, option_label.split(', ')):
|
||||
exploded_options[option_key] = option_label
|
||||
if option_keys and option_label:
|
||||
for option_key, option_label in zip(option_keys, option_label.split(', ')):
|
||||
exploded_options[option_key] = option_label
|
||||
options = list(sorted(exploded_options.items(), key=lambda x: x[1]))
|
||||
|
||||
options = [(force_str(x), force_str(y)) for x, y in options if x and y]
|
||||
|
|
Loading…
Reference in New Issue