'Goes through all the migrations, and works out the dependencies.'

@classmethod
def calculate_dependencies(cls, force=False):

    if (getattr(cls, '_dependencies_done', False) and (not force)):
        return
    for migrations in all_migrations():
        for migration in migrations:
            migration.calculate_dependencies()
    cls._dependencies_done = True
