def _filter_child_model_fields(cls, fields):
        """ Keep only related model fields.

        Example: Inherited models: A -> B -> C
        B has one-to-many relationship to BMany.
        after inspection BMany would have links to B and C. Keep only B. Parent
        model A could not be used (It would not be in fields)

        :param list fields: model fields.
        :return list fields: filtered fields.

        """
        indexes_to_remove = set([])
        for index1, field1 in enumerate(fields):
            for index2, field2 in enumerate(fields):
                if index1 < index2 and index1 not in indexes_to_remove and\
                        index2 not in indexes_to_remove:
                    if issubclass(field1.related_model, field2.related_model):
                        indexes_to_remove.add(index1)

                    if issubclass(field2.related_model, field1.related_model):
                        indexes_to_remove.add(index2)

        fields = [field for index, field in enumerate(fields)
                  if index not in indexes_to_remove]

        return fields
Keep only related model fields.

        Example: Inherited models: A -> B -> C
        B has one-to-many relationship to BMany.
        after inspection BMany would have links to B and C. Keep only B. Parent
        model A could not be used (It would not be in fields)

        :param list fields: model fields.
        :return list fields: filtered fields.