Commit e74772b8 by Osiloke Emoekpere

This accounts for none(null) values of rel.to when converting model fields from native

parent 027c9079
......@@ -211,9 +211,9 @@ class ModelField(WritableField):
def from_native(self, value):
try:
rel = self.model_field.rel
return rel.to._meta.get_field(rel.field_name).to_python(value)
except:
return self.model_field.to_python(value)
return rel.to._meta.get_field(rel.field_name).to_python(value)
def field_to_native(self, obj, field_name):
value = self.model_field._get_val_from_obj(obj)
......
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