Skip to content

digiplan.map.views#

Views for map app.

As map app is SPA, this module contains main view and various API points.

DetailKeyResultsView #

Bases: TemplateView

Return HTMX-partial for requested detail key results.

get_context_data(**kwargs) #

Get detail key results for requested technology.

MapGLView #

Bases: TemplateView, MapEngineMixin

Main view for map app (SPA).

get_context_data(**kwargs) #

Context data for main view.

Parameters#

kwargs Optional kwargs

Returns#

dict context for main view

get_charts(request) #

Return all result charts at once.

Parameters#

request: HttpRequest request holding simulation ID in map_state dict

Returns#

JsonResponse holding dict with div_id as keys and chart options as values. div_id is used in frontend to detect chart container.

get_choropleth(request, lookup, layer_id) #

Read scenario results from database, aggregate data and send back data.

Parameters#

request : HttpRequest Request can contain optional values (i.e. language) lookup : str which result/calculation shall be shown in choropleth? layer_id : str layer ID of given choropleth

Returns#

JsonResponse Containing key-value pairs of municipality_ids and values and related color style

get_popup(request, lookup, region) #

Return popup as html and chart options to render chart on popup.

Parameters#

request : HttpRequest Request from app, can hold option for different language lookup: str Name is used to lookup data and chart functions region: int ID of region selected on map. Data and chart for popup is calculated for related region.

Returns#

JsonResponse containing HTML to render popup and chart options to be used in E-Chart.

get_summary_results(request) #

Return all summary results as HTMLs with related div ID.

Parameters#

request: HttpRequest holding user settings

Returns#

JsonResponse holding dict containing div IDs as key and summary results as HTML as values