def filter_featured_apps(admin_apps, request):
    """
    Given a list of apps return a set of pseudo-apps considered featured.

    Apps are considered featured if the are defined in the settings
    property called `DASHBOARD_FEATURED_APPS` which contains a list of the apps
    that are considered to be featured.

    :param admin_apps: A list of apps.
    :param request: Django request.
    :return: Subset of app like objects that are listed in
    the settings `DASHBOARD_FEATURED_APPS` setting.
    """
    featured_apps = []

    # Build the featured apps list based upon settings.
    for orig_app_spec in appsettings.DASHBOARD_FEATURED_APPS:
        # make a copy that we can write to, to fix deprecations without
        # changing settings
        app_spec = orig_app_spec.copy()

        if "verbose_name" in app_spec:
            warnings.warn(
                "DASHBOARD_FEATURED_APPS[]['verbose_name'] = '%s' is deprecated. "
                "Use 'name' instead)" % app_spec['verbose_name'],
                DeprecationWarning, stacklevel=2
            )
            app_spec['name'] = app_spec['verbose_name']

        if hasattr(app_spec['models'], 'items'):
            warnings.warn(
                "DASHBOARD_FEATURED_APPS[]['models'] for '%s' should now be a "
                "list of tuples, not a dict." % app_spec['name'],
                DeprecationWarning, stacklevel=2
            )
            app_spec['models'] = app_spec['models'].items()

        # lookup the models from the names
        app_spec['models'] = _build_app_models(
            request, admin_apps, app_spec['models']
        )

        # Only add the panel if at least one model is listed.
        if app_spec['models']:
            featured_apps.append(app_spec)

    return featured_apps
def filter_featured_apps ( admin_apps , request ) : featured_apps = [ ] for orig_app_spec in appsettings . DASHBOARD_FEATURED_APPS : app_spec = orig_app_spec . copy ( ) if "verbose_name" in app_spec : warnings . warn ( "DASHBOARD_FEATURED_APPS[]['verbose_name'] = '%s' is deprecated. " "Use 'name' instead)" % app_spec [ 'verbose_name' ] , DeprecationWarning , stacklevel = 2 ) app_spec [ 'name' ] = app_spec [ 'verbose_name' ] if hasattr ( app_spec [ 'models' ] , 'items' ) : warnings . warn ( "DASHBOARD_FEATURED_APPS[]['models'] for '%s' should now be a " "list of tuples, not a dict." % app_spec [ 'name' ] , DeprecationWarning , stacklevel = 2 ) app_spec [ 'models' ] = app_spec [ 'models' ] . items ( ) app_spec [ 'models' ] = _build_app_models ( request , admin_apps , app_spec [ 'models' ] ) if app_spec [ 'models' ] : featured_apps . append ( app_spec ) return featured_apps
Given a list of apps return a set of pseudo-apps considered featured.

    Apps are considered featured if the are defined in the settings
    property called `DASHBOARD_FEATURED_APPS` which contains a list of the apps
    that are considered to be featured.

    :param admin_apps: A list of apps.
    :param request: Django request.
    :return: Subset of app like objects that are listed in
    the settings `DASHBOARD_FEATURED_APPS` setting.