Added TextField to recognized fields

This commit is contained in:
Jens Alm 2012-10-15 09:14:01 +02:00
parent 41dd63b3b0
commit 241be38340
2 changed files with 8 additions and 0 deletions

View File

@ -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'

View File

@ -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,
}