mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-23 15:54:16 +03:00
Merge pull request #2340 from shtouff/fix-htmlform-textarea
Use textarea input for 'models.TextField'.
This commit is contained in:
commit
9f9b9f8944
|
@ -80,7 +80,7 @@ def get_field_kwargs(field_name, model_field):
|
||||||
kwargs['decimal_places'] = decimal_places
|
kwargs['decimal_places'] = decimal_places
|
||||||
|
|
||||||
if isinstance(model_field, models.TextField):
|
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 isinstance(model_field, models.AutoField) or not model_field.editable:
|
||||||
# If this field is read-only, then return early.
|
# If this field is read-only, then return early.
|
||||||
|
|
|
@ -119,7 +119,7 @@ class TestRegularFieldMappings(TestCase):
|
||||||
positive_small_integer_field = IntegerField()
|
positive_small_integer_field = IntegerField()
|
||||||
slug_field = SlugField(max_length=100)
|
slug_field = SlugField(max_length=100)
|
||||||
small_integer_field = IntegerField()
|
small_integer_field = IntegerField()
|
||||||
text_field = CharField(style={'type': 'textarea'})
|
text_field = CharField(style={'base_template': 'textarea.html'})
|
||||||
time_field = TimeField()
|
time_field = TimeField()
|
||||||
url_field = URLField(max_length=100)
|
url_field = URLField(max_length=100)
|
||||||
custom_field = ModelField(model_field=<tests.test_model_serializer.CustomField: custom_field>)
|
custom_field = ModelField(model_field=<tests.test_model_serializer.CustomField: custom_field>)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user