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

Serializer IntegerField will not accept null values even if allow_null=True #8036

Closed
2 of 3 tasks
dralley opened this issue Jun 15, 2021 · 0 comments
Closed
2 of 3 tasks

Comments

@dralley
Copy link

dralley commented Jun 15, 2021

The serializer looks like this

class RepositorySerializer(ModelSerializer):
    # blah blah

    retained_versions = serializers.IntegerField(
        allow_null=True,
        required=False,
        min_value=1,  # not needed to reproduce
    )

    # blah blah

When POSTing or PATCHing, integer values work fine. However, despite allow_null=True, null values are rejected.

{
    "retained_versions": [
        "A valid integer is required."
    ]
}

Checklist

  • Raised initially as discussion #...
  • This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
  • I have reduced the issue to the simplest possible case.
@dralley dralley closed this as completed Jun 16, 2021
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

1 participant