From 2e74d379e453c1e056047e90ca27fa70a8ffc898 Mon Sep 17 00:00:00 2001 From: Doug Tabuchi Date: Tue, 27 Mar 2012 19:06:32 -0400 Subject: [PATCH] Don't add unknown field errors if allow_unknown_form_fields is set --- djangorestframework/resources.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/djangorestframework/resources.py b/djangorestframework/resources.py index f170eb45a..5869ba6cf 100644 --- a/djangorestframework/resources.py +++ b/djangorestframework/resources.py @@ -168,9 +168,10 @@ class FormResource(Resource): if not key.startswith('__') ) - # Add any unknown field errors - for key in unknown_fields: - field_errors[key] = [u'This field does not exist.'] + if not self.allow_unknown_form_fields: + # Add any unknown field errors + for key in unknown_fields: + field_errors[key] = [u'This field does not exist.'] if field_errors: detail[u'field_errors'] = field_errors