Skip to content

Commit

Permalink
split layer list into non-result and result in context var, #38
Browse files Browse the repository at this point in the history
this allows to load result layers on demand instead at statup
  • Loading branch information
nesnoj committed May 23, 2019
1 parent 3418146 commit f22a9c8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,17 @@ def __init__(self):

def get_context_data(self, **kwargs):
context = super(MapView, self).get_context_data(**kwargs)
context.update(io.prepare_layer_data())

# prepare layer data and move result layers to separate context var
layer_data = io.prepare_layer_data()
layer_data['layer_list'] = {layer: data
for layer, data in layer_data['layer_list'].items()
if data['cat'] != 'results'}
layer_data['layer_list_results'] = {layer: data
for layer, data in layer_data['layer_list'].items()
if data['cat'] == 'results'}
context.update(layer_data)

context.update(io.prepare_component_data())
context.update(io.prepare_scenario_data())
context.update(io.prepare_label_data())
Expand Down

0 comments on commit f22a9c8

Please sign in to comment.