aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/resources.py
diff options
context:
space:
mode:
authorAlen Mujezinovic2011-06-10 12:36:04 +0100
committerAlen Mujezinovic2011-06-10 12:36:04 +0100
commit06177b8d4b77bcfe7d945d2a593ab3458c8fa528 (patch)
treee3ebbfc89ea1e3be25e0ad03ab34dc872ce2369e /djangorestframework/resources.py
parentd034c0fe4f1dbae77dccc9709335ad877700ed54 (diff)
downloaddjango-rest-framework-06177b8d4b77bcfe7d945d2a593ab3458c8fa528.tar.bz2
`bound_form.cleaned_data` already returns the file data if there was any.
`bound_form.files` returns a `MultiValueDict` which errors when passing `.CONTENT` into a model constructor.
Diffstat (limited to 'djangorestframework/resources.py')
-rw-r--r--djangorestframework/resources.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/djangorestframework/resources.py b/djangorestframework/resources.py
index 4b81bf79..cc4b6471 100644
--- a/djangorestframework/resources.py
+++ b/djangorestframework/resources.py
@@ -241,14 +241,12 @@ class FormResource(Resource):
# In addition to regular validation we also ensure no additional fields are being passed in...
unknown_fields = seen_fields_set - (form_fields_set | allowed_extra_fields_set)
unknown_fields = unknown_fields - set(('csrfmiddlewaretoken', '_accept', '_method')) # TODO: Ugh.
-
+
# Check using both regular validation, and our stricter no additional fields rule
if bound_form.is_valid() and not unknown_fields:
# Validation succeeded...
cleaned_data = bound_form.cleaned_data
- cleaned_data.update(bound_form.files)
-
# Add in any extra fields to the cleaned content...
for key in (allowed_extra_fields_set & seen_fields_set) - set(cleaned_data.keys()):
cleaned_data[key] = data[key]