diff --git a/spatial/templates/spatial/index.html b/spatial/templates/spatial/index.html index 744412e20d2e52e9cb155430c4988ca4494d8af3..cf34d74b49ee46df17b77102a1ef8faabfe48400 100644 --- a/spatial/templates/spatial/index.html +++ b/spatial/templates/spatial/index.html @@ -39,9 +39,9 @@ <p>{% trans "Risk maps in IPM Decisions (Europe)"%}: <a href="https://platform.ipmdecisions.net/" target="new">https://platform.ipmdecisions.net/</a></p> <p>{% trans "Risk maps for Malawi - see the progress here"%}: <a href="https://madiphs.org/" target="new">https://madiphs.org/</a></p> <h2>{% trans "Available risk maps" %}</h2> -{% if available_grid_models|length > 0 %} +{% if visible_grid_models|length > 0 %} <ul> - {% for model in available_grid_models %} + {% for model in visible_grid_models %} <li><a href="gridmap/{{model.model_id}}/">{% get_text_i18n model.model_name %}</a></li> {% endfor %} </ul> diff --git a/spatial/views.py b/spatial/views.py index 9a0aa0c18e75a73e35d5db96c94a6934609d562e..db9d4909b2c5157f300ae7aef8381df2eee4eb5e 100644 --- a/spatial/views.py +++ b/spatial/views.py @@ -25,8 +25,14 @@ from django.conf import settings # Fallback view - only displaying info for user to move on def index(request): + visible_grid_models = [] + if hasattr(settings, "AVAILABLE_GRID_MODELS"): + for model in settings.AVAILABLE_GRID_MODELS: + if model.get("hidden", "false") == "false": + visible_grid_models.append(model) + context = { - "available_grid_models": settings.AVAILABLE_GRID_MODELS if hasattr(settings, "AVAILABLE_GRID_MODELS") else [] + "visible_grid_models": visible_grid_models } return render(request, 'spatial/index.html', context)