mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 00:38:45 -03:30
Show API choice field metadata more correctly for null vs ''
This commit is contained in:
@@ -101,8 +101,10 @@ class Metadata(metadata.SimpleMetadata):
|
|||||||
(choice_value, choice_name) for choice_value, choice_name in field.choices.items()
|
(choice_value, choice_name) for choice_value, choice_name in field.choices.items()
|
||||||
]
|
]
|
||||||
if not any(choice in ('', None) for choice, _ in choices):
|
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
|
choices = [("", "---------")] + choices
|
||||||
|
if field.allow_null and not isinstance(field, ChoiceNullField):
|
||||||
|
choices = [(None, "---------")] + choices
|
||||||
field_info['choices'] = choices
|
field_info['choices'] = choices
|
||||||
|
|
||||||
# Indicate if a field is write-only.
|
# Indicate if a field is write-only.
|
||||||
|
|||||||
Reference in New Issue
Block a user