This commit is contained in:
Marko Tibold 2012-11-16 22:18:57 +01:00
parent 4edc801d59
commit aa013a4289

View File

@ -427,6 +427,12 @@ class ModelSerializer(Serializer):
kwargs['choices'] = model_field.flatchoices kwargs['choices'] = model_field.flatchoices
return ChoiceField(**kwargs) return ChoiceField(**kwargs)
max_length = getattr(model_field, 'max_length', None)
if max_length:
if not isinstance(model_field, models.CharField):
import pdb; pdb.set_trace()
kwargs['max_length'] = max_length
field_mapping = { field_mapping = {
models.FloatField: FloatField, models.FloatField: FloatField,
models.IntegerField: IntegerField, models.IntegerField: IntegerField,