Check that all the depenedencies for this model are already in the queue.

def check_dependencies(model, model_queue, avaliable_models):
    """ Check that all the depenedencies for this model are already in the queue. """
    # 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 not field.remote_field:
            continue
        if field.remote_field.model.__name__ not in allowed_links:
            if field.remote_field.model not in avaliable_models:
                continue
            return False

    for field in model._meta.many_to_many:
        if not field.remote_field:
            continue
        if field.remote_field.model.__name__ not in allowed_links:
            return False

    return True