diff --git a/django_setup_configuration/documentation/setup_config_example.py b/django_setup_configuration/documentation/setup_config_example.py index f6d9084..cce0e10 100644 --- a/django_setup_configuration/documentation/setup_config_example.py +++ b/django_setup_configuration/documentation/setup_config_example.py @@ -284,7 +284,7 @@ def _process_field_type( primary_type, *other_types = union_types data = _process_field_type(primary_type, field_info, field_name, depth) - if other_types == [NoneType]: + if all(union_type in (NoneType, Literal[""]) for union_type in other_types): return data commented_out_examples = [ diff --git a/tests/test_documentation.py b/tests/test_documentation.py index f82180f..1f277a0 100644 --- a/tests/test_documentation.py +++ b/tests/test_documentation.py @@ -80,6 +80,7 @@ class Meta: "int_with_choices_and_blank_and_non_choice_default", "str_with_localized_default", "int_with_lazy_default", + "blank_str", ) } extra_kwargs = { @@ -269,6 +270,10 @@ def test_directive_output(register_directive, docutils_document): # DEFAULT VALUE: 42 # REQUIRED: false int_with_lazy_default: 42 + + # DEFAULT VALUE: "" + # REQUIRED: false + blank_str: example_string """ )