Django View

Main dashboard view.

This module provides the primary authenticated dashboard view that renders the React-based dashboard page. Responses are lightly cached on a per-user basis (DASHBOARD_CACHE_TIMEOUT seconds) to keep the UI snappy without serving stale data.

Unauthenticated requests are redirected to the login page.

smarter.apps.dashboard.views.views.dashboard.DASHBOARD_CACHE_TIMEOUT

Per-user response cache lifetime in seconds (default: 10).

Type:

int

Classes:
DashboardView: Authenticated, lightly cached view that renders the React

dashboard page.

Example

Wire up the view in your URL configuration:

from smarter.apps.dashboard.views.views.dashboard import DashboardView

urlpatterns = [
    path("", DashboardView.as_view(), name="dashboard"),
]
class smarter.apps.dashboard.views.views.dashboard.DashboardView(**kwargs)[source]

Bases: SmarterAuthenticatedNeverCachedWebView

Authenticated, per-user cached view that renders the React dashboard page.

Extends SmarterAuthenticatedWebView. Two decorators are applied at dispatch time:

On a GET request the view redirects unauthenticated users to the login page, otherwise it builds a context dictionary containing API URLs for the “My Resources” and “Service Health” React widgets, then renders react/dashboard.html.

template_path

Set at request time to "react/dashboard.html".

Type:

str

property formatted_class_name: str

Returns the class name in a formatted string along with the name of this view.

get(request, *args, **kwargs)[source]

Handle GET requests to render the dashboard page for authenticated users.

Parameters:
  • request (HttpRequest) – The incoming HTTP GET request from the client.

  • args – Additional positional arguments forwarded by the URL dispatcher.

  • kwargs – Additional keyword arguments forwarded by the URL dispatcher.

Returns:

An HTTP response with the rendered dashboard page for authenticated users, or a redirect to the login page for unauthenticated users.

Return type:

HttpResponse

template_path: str = 'react/dashboard.html'