Multi-level dictionaries not supported in multipart requests · Issue #3314 · encode/django-rest-framework (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@nazarewk

Description

@nazarewk

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