Commit 8db63671 by Tom Christie

Deal with 1.9's differing null behavior on reverse relationships and m2m

parent b51c1ff0
...@@ -233,9 +233,11 @@ def get_relation_kwargs(field_name, relation_info): ...@@ -233,9 +233,11 @@ def get_relation_kwargs(field_name, relation_info):
# No further keyword arguments are valid. # No further keyword arguments are valid.
return kwargs return kwargs
if model_field.has_default() or model_field.blank or model_field.null: 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 model_field.null: if 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment