mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-12-01 22:14:06 +03:00
make sure max_length is in FileField kwargs
This commit is contained in:
parent
26623436f3
commit
04adfb9c94
|
@ -192,7 +192,8 @@ def get_field_kwargs(field_name, model_field):
|
||||||
# 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 and (isinstance(model_field, models.CharField) or
|
if max_length is not None and (isinstance(model_field, models.CharField) or
|
||||||
isinstance(model_field, models.TextField)):
|
isinstance(model_field, models.TextField) or
|
||||||
|
isinstance(model_field, models.FileField)):
|
||||||
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