Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing tag validation in TaggitSerializer and TagListSerializerField #919

Open
bluesurfer opened this issue Aug 28, 2024 · 1 comment
Open

Comments

@bluesurfer
Copy link

bluesurfer commented Aug 28, 2024

When using TaggitSerializer with TagListSerializerField tags value is not parsed.

I was expecting the same behavior of TagField in forms:

def clean(self, value):
    value = super().clean(value)
    try:
        return parse_tags(value)
    except ValueError:
        raise forms.ValidationError(
            _("Please provide a comma-separated list of tags.")
        )
@rtpg
Copy link
Contributor

rtpg commented Sep 29, 2024

@bluesurfer here, were you expecting to be able to pass something like "tag_a, tag_b, tag_c" into the serializer? You can already pass in ["tag_a", "tag_b", "tag_c"] and (for backwards compat reasons) "['tag_a', 'tag_b', 'tag_c']".

Forms have their own requirements, but for a REST API it seems a bit odd to be able to pass a comma separated string when you could likely just as easily pass in a list of strings. But I might be lacking imagination on the use case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants