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

ListField data entered in HTML form view should be converted to list #4029

Closed
wants to merge 1 commit into from

Conversation

seawolf42
Copy link
Contributor

Description

This initial PullRequest is just to start the conversation; at the moment this consists simply of a new test that fails until I have a better grasp on what all the right tests are and if this is being approached correctly.

If using the HTML view of the interface to the REST framework, it is not possible to enter ListField data (as far as I can tell). This test verifies that ListField fields can accept pure string input and convert them to a proper list prior to validation.

I am not very knowledgable in how all the testing is set up for DRF, so I might be putting the test in the wrong place. Similar tests should probably also be created for other complex field types. And if this is already supported and I just don't understand how to use the interface, then let me know so I can document the right way to enter ListField data using the HTML interface.

@dvj
Copy link

dvj commented May 28, 2016

It would be nice to add a line to the documentation that states the browsable API doesn't handle ListField input properly. This had me confused for quite a while thinking my code was at fault.

@seawolf42
Copy link
Contributor Author

I think making it handle list fields when entered as a string would be reasonable when data is received as a form instead of JSON... I am happy to do the work if I can get help understanding a couple things in the code.

jeff

On May 27, 2016, at 16:04, Doug Johnston [email protected] wrote:

It would be nice to add a line to the documentation that states the browsable API doesn't handle ListField input properly. This had me confused for quite a while thinking my code was at fault.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@carltongibson
Copy link
Collaborator

I'm going to close this as Out of Scope for now. #5702 disabled HTML inputs for list and dict fields.

The tests added in #5927 to test_fields.py show how multipart input can handle lists and dicts. What's needed for a solution here is a ECMAScript widget to map from a UI format to the multipart data. (You then override the templates to use said widget.)

At least for now, such things need to live in a third-party package. Maybe we have capacity to improve the capabilities of the browsable API in the future.

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

Successfully merging this pull request may close these issues.

3 participants