mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-09-21 03:19:00 +03:00
Adjust ModelField.null mappings now that Django-25320 is resolved
This commit is contained in:
parent
f87573ffa3
commit
afd2a8f8f0
|
@ -233,14 +233,9 @@ def get_relation_kwargs(field_name, relation_info):
|
||||||
# No further keyword arguments are valid.
|
# No further keyword arguments are valid.
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
# Currently required for 1.9 master behavior,
|
if model_field.has_default() or model_field.blank or model_field.null:
|
||||||
# may be able to remove this with 1.9 alpha.
|
|
||||||
# See https://code.djangoproject.com/ticket/25320
|
|
||||||
null = model_field.null and not to_many
|
|
||||||
|
|
||||||
if model_field.has_default() or model_field.blank or null:
|
|
||||||
kwargs['required'] = False
|
kwargs['required'] = False
|
||||||
if null:
|
if model_field.null:
|
||||||
kwargs['allow_null'] = True
|
kwargs['allow_null'] = True
|
||||||
if model_field.validators:
|
if model_field.validators:
|
||||||
kwargs['validators'] = model_field.validators
|
kwargs['validators'] = model_field.validators
|
||||||
|
|
Loading…
Reference in New Issue
Block a user