diff options
| author | Tom Christie | 2014-11-13 19:28:57 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-11-13 19:28:57 +0000 |
| commit | ea98de9b889173235a908ee2ce5a2aba5d8223c7 (patch) | |
| tree | 0ef008f76582c86c166191748b00406c42fd053a /rest_framework | |
| parent | 9e75c4d8eab11d1637d65a8a7683f7970a41111b (diff) | |
| download | django-rest-framework-ea98de9b889173235a908ee2ce5a2aba5d8223c7.tar.bz2 | |
Model fields with .blank or .null now map to required=False. Closes #2017. Closes #2021.
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/utils/field_mapping.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rest_framework/utils/field_mapping.py b/rest_framework/utils/field_mapping.py index 24639085..ce339971 100644 --- a/rest_framework/utils/field_mapping.py +++ b/rest_framework/utils/field_mapping.py @@ -88,7 +88,7 @@ def get_field_kwargs(field_name, model_field): kwargs['read_only'] = True return kwargs - if model_field.has_default(): + if model_field.has_default() or model_field.blank or model_field.null: kwargs['required'] = False if model_field.flatchoices: |
