def airavata_app_registry()

in django_airavata/context_processors.py [0:0]


def airavata_app_registry(request):
    """Put airavata django apps into the context."""
    airavata_apps = [app for app in apps.get_app_configs()
                     if isinstance(app, AiravataAppConfig) and
                     (getattr(app, 'enabled', None) is None or
                      app.enabled(request)
                      ) and
                     app.label not in settings.HIDDEN_AIRAVATA_APPS]
    # Sort by app_order then by verbose_name (case-insensitive)
    airavata_apps.sort(
        key=lambda app: "{:09}-{}".format(app.app_order,
                                          app.verbose_name.lower()))
    current_app = _get_current_app(request, airavata_apps)

    return {
        'airavata_apps': airavata_apps,
        'current_airavata_app': current_app,
        'airavata_app_nav': (_get_app_nav(request, current_app)
                             if current_app else None)
    }