mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Added TextField to recognized fields
This commit is contained in:
parent
41dd63b3b0
commit
241be38340
|
@ -409,6 +409,13 @@ class BooleanField(WritableField):
|
|||
return False
|
||||
raise ValidationError(self.error_messages['invalid'] % value)
|
||||
|
||||
class TextField(WritableField):
|
||||
type_name = 'TextField'
|
||||
|
||||
def from_native(self, value):
|
||||
if isinstance(value, basestring) or value is None:
|
||||
return value
|
||||
return smart_unicode(value)
|
||||
|
||||
class CharField(WritableField):
|
||||
type_name = 'CharField'
|
||||
|
|
|
@ -381,6 +381,7 @@ class ModelSerializer(Serializer):
|
|||
models.DateField: DateField,
|
||||
models.EmailField: EmailField,
|
||||
models.CharField: CharField,
|
||||
models.TextField: TextField,
|
||||
models.CommaSeparatedIntegerField: CharField,
|
||||
models.BooleanField: BooleanField,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user