From 650866cc43da38d152c0361ddd030923ff4b13d3 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 3 Aug 2015 09:48:03 +0100 Subject: [PATCH] Blank relational fields map to required=False serializer fields. Closes #3210. --- rest_framework/utils/field_mapping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/utils/field_mapping.py b/rest_framework/utils/field_mapping.py index 9494b0af3..917c8458e 100644 --- a/rest_framework/utils/field_mapping.py +++ b/rest_framework/utils/field_mapping.py @@ -226,7 +226,7 @@ def get_relation_kwargs(field_name, relation_info): # No further keyword arguments are valid. return kwargs - if model_field.has_default() or model_field.null: + if model_field.has_default() or model_field.blank or model_field.null: kwargs['required'] = False if model_field.null: kwargs['allow_null'] = True