From 4bb504732d045fb7db0fc1ddc1fc926197dd2c91 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 7 Jan 2013 21:08:55 +0000 Subject: [PATCH] Respect blank=True on relational fields. Fixes #537 --- rest_framework/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index fa92838b6..19a955b85 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -430,7 +430,7 @@ class ModelSerializer(Serializer): # TODO: filter queryset using: # .using(db).complex_filter(self.rel.limit_choices_to) kwargs = { - 'null': model_field.null, + 'null': model_field.null or model_field.blank, 'queryset': model_field.rel.to._default_manager }