'Return the field on the current model which points to the given
"ancestor". This is possible an indirect link (a pointer to a parent
model, which points, eventually, to the ancestor). Used when
constructing table joins for model inheritance.
Return None if the model isn\'t an ancestor of this one.'

def get_ancestor_link(self, ancestor):

    if (ancestor in self.parents):
        return self.parents[ancestor]
    for parent in self.parents:
        parent_link = parent._meta.get_ancestor_link(ancestor)
        if parent_link:
            return (self.parents[parent] or parent_link)
