mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
Show API choice field metadata more correctly for null vs ''
This commit is contained in:
parent
66c98ca9bc
commit
d849e81891
@ -101,8 +101,10 @@ class Metadata(metadata.SimpleMetadata):
|
||||
(choice_value, choice_name) for choice_value, choice_name in field.choices.items()
|
||||
]
|
||||
if not any(choice in ('', None) for choice, _ in choices):
|
||||
if field.allow_blank or (field.allow_null and not isinstance(field, ChoiceNullField)):
|
||||
if field.allow_blank:
|
||||
choices = [("", "---------")] + choices
|
||||
if field.allow_null and not isinstance(field, ChoiceNullField):
|
||||
choices = [(None, "---------")] + choices
|
||||
field_info['choices'] = choices
|
||||
|
||||
# Indicate if a field is write-only.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user