Merge pull request #3012 from jannon/fix-allow-blank-mapping

only include 'allow_blank' on supported fields
This commit is contained in:
Tom Christie 2015-06-24 11:01:10 +01:00
commit 8d4c96ecd6

View File

@ -102,7 +102,8 @@ def get_field_kwargs(field_name, model_field):
if model_field.null and not isinstance(model_field, models.NullBooleanField): if model_field.null and not isinstance(model_field, models.NullBooleanField):
kwargs['allow_null'] = True kwargs['allow_null'] = True
if model_field.blank: if model_field.blank and (isinstance(model_field, models.CharField) or
isinstance(model_field, models.TextField)):
kwargs['allow_blank'] = True kwargs['allow_blank'] = True
if model_field.flatchoices: if model_field.flatchoices: