Commits

Ionel Cristian Mărieș committed d652b18

Changed INHERITED_FLAG_FIELD_NAME to the is_foo_inherited variant;
Added a fix for find_on_model in case it gets the (model, field) tuple from find_in parent.

  • Participants
  • Parent commits e228c4d

Comments (0)

Files changed (1)

dcfields/inheritedfield.py

 import copy
 from collections import defaultdict
 
-INHERITED_FLAG_FIELD_NAME = "%s_is_inherited"
+INHERITED_FLAG_FIELD_NAME = "is_%s_inherited"
 INHERITED_VALUE_FIELD_NAME = "%s_inherited_value"
 LOCAL_VALUE_FIELD_NAME = "%s_local_value"
 
         MAP = getattr(model, 'FIELD_INHERITANCE_MAP')
         if field_name in MAP:
             rel, field, sync = MAP[field_name]
-            return find_in_parent(origin, model, rel, field, validate, callback, chain)
+            result = find_in_parent(origin, model, rel, field, validate, callback, chain)
+            if result:
+                parent_model, field = result
+                return field
         elif validate:
             raise TypeError("InheritedField: %s does not exist in %s." %
                                 (field_name, model))