make sure max_length is in FileField kwargs

This commit is contained in:
Dryice Liu 2017-05-28 04:14:56 +08:00
parent 26623436f3
commit 04adfb9c94

View File

@ -192,7 +192,8 @@ def get_field_kwargs(field_name, model_field):
# rather than as a validator.
max_length = getattr(model_field, 'max_length', None)
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
validator_kwarg = [
validator for validator in validator_kwarg