From f5b8c1a7bd6448657daa405d8f80d5ee37f22fb5 Mon Sep 17 00:00:00 2001 From: Cameron Hyde Date: Wed, 13 Dec 2023 16:14:22 +1000 Subject: [PATCH] Fix tracks/genomes url rename --- apollo_portal/tracks/admin.py | 6 +++--- .../tracks/templates/tracks/snippets/genome-cards.html | 8 ++++---- .../tracks/templates/tracks/snippets/tracks-table.html | 8 ++++---- apollo_portal/tracks/templates/tracks/tracks.html | 2 +- apollo_portal/tracks/views.py | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/apollo_portal/tracks/admin.py b/apollo_portal/tracks/admin.py index b86e255..e59ea6e 100644 --- a/apollo_portal/tracks/admin.py +++ b/apollo_portal/tracks/admin.py @@ -15,7 +15,7 @@ def _genome_name(self, track): @admin.display(ordering="lab__name") def _lab_name(self, genome): return format_html( - '{}', + '{}', genome.lab.id, genome.lab.name, ) @@ -27,7 +27,7 @@ class TrackAdmin(admin.ModelAdmin): @admin.display(ordering="genome__name") def _genome_name(self, track): return format_html( - '{}', + '{}', track.genome.id, track.genome.name, ) @@ -35,7 +35,7 @@ def _genome_name(self, track): @admin.display(ordering="lab__name") def _lab_name(self, track): return format_html( - '{}', + '{}', track.lab.id, track.lab.name, ) diff --git a/apollo_portal/tracks/templates/tracks/snippets/genome-cards.html b/apollo_portal/tracks/templates/tracks/snippets/genome-cards.html index 4d16267..c8aeca4 100644 --- a/apollo_portal/tracks/templates/tracks/snippets/genome-cards.html +++ b/apollo_portal/tracks/templates/tracks/snippets/genome-cards.html @@ -8,14 +8,14 @@ 'strain', and 'condition'. e.g. hide_filters = ['lab'] - filter_genomes_params: Object of GET params to pass to /tracks/api/genomes + filter_genomes_params: Object of GET params to pass to /genomes/api/genomes e.g. filter_genomes_params="{group: 'my group', labs: 'my Lab,your lab'}" --> {% load static %} - + {% verbatim %} @@ -573,7 +573,7 @@ params = FILTER_GENOMES_PARAMS; urlParams = "?" + new URLSearchParams(params); } - return fetch('/tracks/api/genomes' + urlParams) + return fetch('/genomes/api/genomes' + urlParams) .catch(error => { alert(error); }) @@ -590,7 +590,7 @@ }); }, fetchLab (name) { - return fetch(`/tracks/api/labs?labs=${name}`) + return fetch(`/genomes/api/labs?labs=${name}`) .catch(error => { alert(error); }) diff --git a/apollo_portal/tracks/templates/tracks/snippets/tracks-table.html b/apollo_portal/tracks/templates/tracks/snippets/tracks-table.html index c7d2d18..4ef1d9a 100644 --- a/apollo_portal/tracks/templates/tracks/snippets/tracks-table.html +++ b/apollo_portal/tracks/templates/tracks/snippets/tracks-table.html @@ -8,14 +8,14 @@ 'strain', and 'condition'. e.g. hide_filters = ['lab'] - filter_tracks_params: Object of GET params to pass to /tracks/api/tracks + filter_tracks_params: Object of GET params to pass to /genomes/api/tracks e.g. filter_tracks_params="{group: 'my group name', genome_id: genome_id }" --> {% load static %} - + {% verbatim %} @@ -382,7 +382,7 @@ const urlParams = params ? '?' + new URLSearchParams(params) : ''; - return fetch('/tracks/api/tracks/' + urlParams) + return fetch('/genomes/api/tracks/' + urlParams) .catch(error => { alert(error); }) @@ -399,7 +399,7 @@ }); }, fetchLab (name) { - return fetch(`/tracks/api/labs?labs=${name}`) + return fetch(`/genomes/api/labs?labs=${name}`) .catch(error => { alert(error); }) diff --git a/apollo_portal/tracks/templates/tracks/tracks.html b/apollo_portal/tracks/templates/tracks/tracks.html index 895dcbf..6ca69a2 100644 --- a/apollo_portal/tracks/templates/tracks/tracks.html +++ b/apollo_portal/tracks/templates/tracks/tracks.html @@ -72,7 +72,7 @@

Genome tracks: {{ genome.name }}


- {% include 'tracks/snippets/tracks-table.html' %} + {% include 'genomes/snippets/tracks-table.html' %}
diff --git a/apollo_portal/tracks/views.py b/apollo_portal/tracks/views.py index b1df91a..6c015e3 100644 --- a/apollo_portal/tracks/views.py +++ b/apollo_portal/tracks/views.py @@ -6,12 +6,12 @@ def genomes(request): """Genomes list/filter view.""" - return render(request, 'tracks/genomes.html') + return render(request, 'genomes/genomes.html') def tracks(request, genome_id): """Tracks table view.""" genome = Genome.objects.get(id=genome_id) - return render(request, 'tracks/tracks.html', { + return render(request, 'genomes/tracks.html', { 'genome': genome.as_json(), })