mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 10:03:57 +03:00
Test for setting allow_none=True for nullable CharFields
This commit is contained in:
parent
e1bbe9d514
commit
0fd0454a5c
|
@ -1504,6 +1504,7 @@ class AttributeMappingOnAutogeneratedFieldsTests(TestCase):
|
||||||
image_field = models.ImageField(max_length=1024, blank=True)
|
image_field = models.ImageField(max_length=1024, blank=True)
|
||||||
slug_field = models.SlugField(max_length=1024, blank=True)
|
slug_field = models.SlugField(max_length=1024, blank=True)
|
||||||
url_field = models.URLField(max_length=1024, blank=True)
|
url_field = models.URLField(max_length=1024, blank=True)
|
||||||
|
nullable_char_field = models.CharField(max_length=1024, blank=True, null=True)
|
||||||
|
|
||||||
class AMOAFSerializer(serializers.ModelSerializer):
|
class AMOAFSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -1536,6 +1537,10 @@ class AttributeMappingOnAutogeneratedFieldsTests(TestCase):
|
||||||
'url_field': [
|
'url_field': [
|
||||||
('max_length', 1024),
|
('max_length', 1024),
|
||||||
],
|
],
|
||||||
|
'nullable_char_field': [
|
||||||
|
('max_length', 1024),
|
||||||
|
('allow_none', True),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
def field_test(self, field):
|
def field_test(self, field):
|
||||||
|
@ -1572,6 +1577,9 @@ class AttributeMappingOnAutogeneratedFieldsTests(TestCase):
|
||||||
def test_url_field(self):
|
def test_url_field(self):
|
||||||
self.field_test('url_field')
|
self.field_test('url_field')
|
||||||
|
|
||||||
|
def test_nullable_char_field(self):
|
||||||
|
self.field_test('nullable_char_field')
|
||||||
|
|
||||||
|
|
||||||
class DefaultValuesOnAutogeneratedFieldsTests(TestCase):
|
class DefaultValuesOnAutogeneratedFieldsTests(TestCase):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user