Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Datasources with List[str] attributes throw exception due to passing 'allow_blank' to serializers #59

Open
chrisdevereux opened this issue Jul 2, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@chrisdevereux
Copy link
Contributor

Resolved with override:

    def get_serializer_field_kwargs(self, field):
        type_info = get_type_info(field.type)

        if type_info.base_type == str and not type_info.is_many and not type_info.is_mapping:
            return {"allow_blank": True}

        if type_info.is_mapping or type_info.is_many:
            return {"allow_empty": True}

        return {}
@janbaykara janbaykara added the bug Something isn't working label Sep 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants