mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 00:04:16 +03:00
Only pass max_length for CharField. Closes #2317.
This commit is contained in:
parent
27f84aa0f3
commit
ef2eff2aba
|
@ -106,7 +106,7 @@ def get_field_kwargs(field_name, model_field):
|
||||||
# Ensure that max_length is passed explicitly as a keyword arg,
|
# Ensure that max_length is passed explicitly as a keyword arg,
|
||||||
# rather than as a validator.
|
# rather than as a validator.
|
||||||
max_length = getattr(model_field, 'max_length', None)
|
max_length = getattr(model_field, 'max_length', None)
|
||||||
if max_length is not None:
|
if max_length is not None and isinstance(model_field, models.CharField):
|
||||||
kwargs['max_length'] = max_length
|
kwargs['max_length'] = max_length
|
||||||
validator_kwarg = [
|
validator_kwarg = [
|
||||||
validator for validator in validator_kwarg
|
validator for validator in validator_kwarg
|
||||||
|
|
Loading…
Reference in New Issue
Block a user