def check_dependencies(model, model_queue, avaliable_models):

    # A list of allowed links: existing fields, itself and the special case ContentType
    allowed_links = [m.model.__name__ for m in model_queue] + [model.__name__, 'ContentType']

    # For each ForeignKey or ManyToMany field, check that a link is possible

    for field in model._meta.fields:
        if field.rel and field.rel.to.__name__ not in allowed_links:
            if field.rel.to not in avaliable_models:
                continue
            return False

    for field in model._meta.many_to_many:
        if field.rel and field.rel.to.__name__ not in allowed_links:
            return False

    return True


# EXCEPTIONS
#-------------------------------------------------------------------------------
Resolves symbolic links.
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/django-extensions-1.5.0/django_extensions/management/commands/dumpscript.py/check_dependencies--crossover with--dataset/ETHPy150Open pypa/pip/tests/lib/path.py/Path.realpath