-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
ListField should enforce that input is a list #3513
ListField should enforce that input is a list #3513
Conversation
I could include tuples and sets
|
Thanks for the path.
|
You're right, I think excluding dictionaries from the ListField in addition to what was already in that line would do the trick. |
Agree - excluding dicts sounds like a good way around to do this. |
Note: by dict we should read any mapping type. |
IDK - any chance that could be a bit fuzzy in cases we've not thought of? |
Well, collections.Mapping should be a good base class to test against (as opposed to just dict). |
Probably want tests that prove this works as intended. |
Yup, having tests would be great so we merge it. |
Tests added. |
Looks good, thanks! |
…orce_list ListField does not enforce that input is a list
Purpose
A dictionary is allowed as input in a ListField. If a dictionary is received as input, the keys of the object are retained, and the values are ignored. I assume the ListField should enforce that the input is an array, especially because the error message in
to_internal_value
includes "not a list" if something is wrong with the data.Changes
Enforces that data cannot be a collections.Mapping.