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

Exception raised when passing a dictionary value to an API ChoiceField #2676

Closed
jeremystretch opened this issue Dec 11, 2018 · 0 comments
Closed
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@jeremystretch
Copy link
Member

Environment

  • Python version: 3.5.2
  • NetBox version: 2.5.0

Steps to Reproduce

Issue the following API request to create a new prefix:

curl -X POST \
-H "Authorization: Token <TOKEN>" \
-H "Content-Type: application/json" \
-H "Accept: application/json; indent=4" \
http://<NETBOX>/api/ipam/prefixes/ \
--data '{"prefix": "192.0.2.0/24", "status": {"foo": "bar"}}'

Expected Behavior

The API response should indicate an invalid value for status.

Observed Behavior

An exception is raised:

TypeError: int() argument must be a string, a bytes-like object or a number, not 'dict'
@jeremystretch jeremystretch added type: bug A confirmed report of unexpected behavior in the application status: accepted This issue has been accepted for implementation labels Dec 11, 2018
@jeremystretch jeremystretch changed the title Exception raised when passing a non-integer value to a WritableNestedSerializer choice field Exception raised when passing a non-integer value to an API ChoiceField Dec 11, 2018
@jeremystretch jeremystretch changed the title Exception raised when passing a non-integer value to an API ChoiceField Exception raised when passing a dictionary value to an API ChoiceField Dec 11, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

1 participant