def clear_opts_related_cache(model_class):
        """
        Clear the specified model and its children opts related cache.
        """
        opts = model_class._meta
        if hasattr(opts, '_related_objects_cache'):
            children = [
                related_object.model
                for related_object in opts.get_all_related_objects()
                if related_object.field.rel.parent_link
            ]
        else:
            children = []
        for attr in _opts_related_cache_attrs:
            try:
                delattr(opts, attr)
            except __HOLE__:
                pass
        for child in children:
            clear_opts_related_cache(child)
dataset/ETHPy150Open charettes/django-mutant/mutant/compat.py/clear_opts_related_cache