def _remove_app_models(all_apps, models_to_remove):
    """
    Remove the model specs in models_to_remove from the models specs in the
    apps in all_apps. If an app has no models left, don't include it in the
    output.

    This has the side-effect that the app view e.g. /admin/app/ may not be
    accessible from the dashboard, only the breadcrumbs.
    """

    filtered_apps = []

    for app in all_apps:
        models = [x for x in app['models'] if x not in models_to_remove]
        if models:
            app['models'] = models
            filtered_apps.append(app)

    return filtered_apps
Remove the model specs in models_to_remove from the models specs in the
    apps in all_apps. If an app has no models left, don't include it in the
    output.

    This has the side-effect that the app view e.g. /admin/app/ may not be
    accessible from the dashboard, only the breadcrumbs.