From 86418948d6f700171c2365b671b003d0eab1f5d3 Mon Sep 17 00:00:00 2001 From: mancini <mancini@astron.nl> Date: Thu, 11 Aug 2022 13:55:04 +0200 Subject: [PATCH] Fix views to take into account of multiple atdb sites --- ldvspec/lofardata/templates/lofardata/index.html | 10 +++++++++- ldvspec/lofardata/views.py | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ldvspec/lofardata/templates/lofardata/index.html b/ldvspec/lofardata/templates/lofardata/index.html index 6b0cc119..73d511f6 100644 --- a/ldvspec/lofardata/templates/lofardata/index.html +++ b/ldvspec/lofardata/templates/lofardata/index.html @@ -8,7 +8,15 @@ <table class="table table-striped table-bordered table-sm"> <tbody> - <tr><td>atdb_host</td><td>{{ atdb_host }}</td></tr> + + <tr><td>atdb_host</td> + <td><ul> + {% for atdb_host in atdb_hosts %} + <li>{{ atdb_host.name }} ( <a href="{{ atdb_host.url }}">{{ atdb_host.url }}</a> )</li> + {% endfor %} + </ul> + </td> + </tr> <tr><td>api data</td><td><a href="{% url 'dataproduct' %}">{% url 'dataproduct' %}</a></td></tr> <tr><td>api data-location</td><td><a href="{% url 'datalocation' %}">{% url 'datalocation' %}</a></td></tr> diff --git a/ldvspec/lofardata/views.py b/ldvspec/lofardata/views.py index 144776cb..e3939b73 100644 --- a/ldvspec/lofardata/views.py +++ b/ldvspec/lofardata/views.py @@ -6,7 +6,7 @@ from rest_framework import generics from django_filters import rest_framework as filters from rest_framework.schemas.openapi import AutoSchema -from .models import DataProduct, DataProductFilter, DataLocation, WorkSpecification +from .models import DataProduct, DataProductFilter, DataLocation, WorkSpecification, ATDBProcessingSite from .serializers import DataProductSerializer, \ DataProductFlatSerializer, DataLocationSerializer, \ WorkSpecificationSerializer @@ -42,8 +42,8 @@ class DataProductFilterSet(DynamicFilterSet): # ---------- GUI Views ----------- def index(request): - atdb_host = settings.ATDB_HOST - return render(request, "lofardata/index.html", {'atdb_host': atdb_host}) + atdb_hosts = ATDBProcessingSite.objects.values('name', 'url') + return render(request, "lofardata/index.html", {'atdb_hosts': atdb_hosts}) # ---------- REST API views ---------- -- GitLab