# Path: django_evolution/compat/datastructures.py

# 
# Path: django_evolution/compat/models.py
# def get_models(app_mod=None, include_auto_created=False):
# def set_model_name(model, name):
# def get_model_name(model):
# def get_rel_target_field(field):
# def get_remote_field(field):
# def get_remote_field_model(rel):


from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
    from django.apps.config import AppConfig
    from django.apps.registry import apps
    from django.db.models.loading import cache
from django_evolution.compat.datastructures import OrderedDict
from django_evolution.compat.models import all_models
        # Django >= 1.7
        app_config = AppConfig(app.__name__, app)
        app_config.label = app_label
        app_config.models_module = app

        apps.set_installed_apps(settings.INSTALLED_APPS + [app_config])
    else:
        # Django < 1.7
        cache.app_store[app] = len(cache.app_store)

        if hasattr(cache, 'app_labels'):
            cache.app_labels[app_label] = app


def unregister_app(app_label):
    """Unregister an app in the registry.

    This must be balanced with a :py:func:`register_app` call.

    Args:
        app_label (str):
            The label of the app to register.
    """
    if apps:
        # Django >= 1.7
        #
        # We need to balance the ``set_installed_apps`` from
        # :py:func:`register_app` here.
        apps.unset_installed_apps()


# Path: django_evolution/compat/datastructures.py

# 
# Path: django_evolution/compat/models.py
# def get_models(app_mod=None, include_auto_created=False):
# def set_model_name(model, name):
# def get_model_name(model):
# def get_rel_target_field(field):
# def get_remote_field(field):
# def get_remote_field_model(rel):


# Path: django_evolution/compat/apps.py
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
    from django.apps.config import AppConfig
    from django.apps.registry import apps
    from django.db.models.loading import cache
from django_evolution.compat.datastructures import OrderedDict
from django_evolution.compat.models import all_models

        # Django >= 1.7
        app_config = AppConfig(app.__name__, app)
        app_config.label = app_label
        app_config.models_module = app

        apps.set_installed_apps(settings.INSTALLED_APPS + [app_config])
    else:
        # Django < 1.7
        cache.app_store[app] = len(cache.app_store)

        if hasattr(cache, 'app_labels'):
            cache.app_labels[app_label] = app


def unregister_app(app_label):
    """Unregister an app in the registry.

    This must be balanced with a :py:func:`register_app` call.

    Args:
        app_label (str):
            The label of the app to register.
    """
    if apps:
        # Django >= 1.7
        #
        # We need to balance the ``set_installed_apps`` from
        # :py:func:`register_app` here.
        apps.unset_installed_apps()


    all_models[app_label].clear()