Skip to content

Commit 9f9b9f8

Browse files
committed
Merge pull request #2340 from shtouff/fix-htmlform-textarea
Use textarea input for 'models.TextField'.
2 parents e6041f9 + b32ecde commit 9f9b9f8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

rest_framework/utils/field_mapping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def get_field_kwargs(field_name, model_field):
8080
kwargs['decimal_places'] = decimal_places
8181

8282
if isinstance(model_field, models.TextField):
83-
kwargs['style'] = {'type': 'textarea'}
83+
kwargs['style'] = {'base_template': 'textarea.html'}
8484

8585
if isinstance(model_field, models.AutoField) or not model_field.editable:
8686
# If this field is read-only, then return early.

tests/test_model_serializer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class Meta:
119119
positive_small_integer_field = IntegerField()
120120
slug_field = SlugField(max_length=100)
121121
small_integer_field = IntegerField()
122-
text_field = CharField(style={'type': 'textarea'})
122+
text_field = CharField(style={'base_template': 'textarea.html'})
123123
time_field = TimeField()
124124
url_field = URLField(max_length=100)
125125
custom_field = ModelField(model_field=<tests.test_model_serializer.CustomField: custom_field>)

0 commit comments

Comments
 (0)