mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-01 11:00:13 +03:00
Do not set the style of a TextField to textarea if choices is set because it will be converted to a ChoiceField and it is more appropriate to let this default to a select box
This commit is contained in:
parent
5f1f2b1003
commit
7c1510d6ec
|
@ -88,7 +88,7 @@ def get_field_kwargs(field_name, model_field):
|
|||
if decimal_places is not None:
|
||||
kwargs['decimal_places'] = decimal_places
|
||||
|
||||
if isinstance(model_field, models.TextField) or (postgres_fields and isinstance(model_field, postgres_fields.JSONField)):
|
||||
if isinstance(model_field, models.TextField) and not model_field.choices or (postgres_fields and isinstance(model_field, postgres_fields.JSONField)):
|
||||
kwargs['style'] = {'base_template': 'textarea.html'}
|
||||
|
||||
if isinstance(model_field, models.AutoField) or not model_field.editable:
|
||||
|
|
Loading…
Reference in New Issue
Block a user