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

Multi-level dictionaries not supported in multipart requests #3314

Closed
nazarewk opened this issue Aug 21, 2015 · 3 comments
Closed

Multi-level dictionaries not supported in multipart requests #3314

nazarewk opened this issue Aug 21, 2015 · 3 comments

Comments

@nazarewk
Copy link

rest_framework.utils.html.is_html_input() combined with rest_framework.utils.html.parse_html_dict() does not detect 3+ level dictionaries, for example.

  1. Multipart representation of {'a':{'b':{'c':123}}} is QueryDict([('a.b.c',123)]), so is_html_input() properly detects nested dictionary.
  2. On the second pass there is {'b.c':123} and is_html_input() does not detect the nested dictionary.

My suggestion is to either instantiate or return MultiValueDict instead of simple dict in parse_html_dict() (and possibly parse_html_list())
https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/utils/html.py

@tomchristie
Copy link
Member

Looks like a valid issue on first pass.

@tomchristie
Copy link
Member

Out of interest what's the use case here, are these HTML forms that you're including on a web site, or is this a client that just happens to be using simulated multipart nesting?

@nazarewk
Copy link
Author

I have the file upload on 3rd level so i have to use multipart.

@tomchristie tomchristie added this to the 3.2.4 Release milestone Sep 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants