mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 00:04:16 +03:00
commit
809f5de330
|
@ -441,7 +441,7 @@ class ModelSerializer(Serializer):
|
||||||
|
|
||||||
kwargs['blank'] = model_field.blank
|
kwargs['blank'] = model_field.blank
|
||||||
|
|
||||||
if model_field.null:
|
if model_field.null or model_field.blank:
|
||||||
kwargs['required'] = False
|
kwargs['required'] = False
|
||||||
|
|
||||||
if model_field.has_default():
|
if model_field.has_default():
|
||||||
|
|
|
@ -751,6 +751,10 @@ class BlankFieldTests(TestCase):
|
||||||
serializer = self.not_blank_model_serializer_class(data=self.data)
|
serializer = self.not_blank_model_serializer_class(data=self.data)
|
||||||
self.assertEquals(serializer.is_valid(), False)
|
self.assertEquals(serializer.is_valid(), False)
|
||||||
|
|
||||||
|
def test_create_model_null_field(self):
|
||||||
|
serializer = self.model_serializer_class(data={})
|
||||||
|
self.assertEquals(serializer.is_valid(), True)
|
||||||
|
|
||||||
|
|
||||||
#test for issue #460
|
#test for issue #460
|
||||||
class SerializerPickleTests(TestCase):
|
class SerializerPickleTests(TestCase):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user