From 6c5ff712783ae7e6edebb52508f1d43249f1aa00 Mon Sep 17 00:00:00 2001 From: Remi Paulmier Date: Mon, 22 Dec 2014 18:05:07 +0100 Subject: [PATCH 1/2] fix the way to use textarea rather than input with models.TextField --- rest_framework/utils/field_mapping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/utils/field_mapping.py b/rest_framework/utils/field_mapping.py index fca97b4b3..b16e9df08 100644 --- a/rest_framework/utils/field_mapping.py +++ b/rest_framework/utils/field_mapping.py @@ -80,7 +80,7 @@ def get_field_kwargs(field_name, model_field): kwargs['decimal_places'] = decimal_places if isinstance(model_field, models.TextField): - kwargs['style'] = {'type': 'textarea'} + kwargs['style'] = {'base_template': 'textarea.html'} if isinstance(model_field, models.AutoField) or not model_field.editable: # If this field is read-only, then return early. From b32ecdefbace063c5b9b465af608ac6404795dd4 Mon Sep 17 00:00:00 2001 From: Remi Paulmier Date: Wed, 24 Dec 2014 14:07:28 +0100 Subject: [PATCH 2/2] modified the tests accordingly --- tests/test_model_serializer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_model_serializer.py b/tests/test_model_serializer.py index da79164af..ee556dbcb 100644 --- a/tests/test_model_serializer.py +++ b/tests/test_model_serializer.py @@ -119,7 +119,7 @@ class TestRegularFieldMappings(TestCase): positive_small_integer_field = IntegerField() slug_field = SlugField(max_length=100) small_integer_field = IntegerField() - text_field = CharField(style={'type': 'textarea'}) + text_field = CharField(style={'base_template': 'textarea.html'}) time_field = TimeField() url_field = URLField(max_length=100) custom_field = ModelField(model_field=)