mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-29 21:14:01 +03:00
Fixes #421
This commit is contained in:
parent
4edc801d59
commit
aa013a4289
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user