From f895a7e44c17cf22b239145372303f110bba3571 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Thu, 21 Jul 2022 11:10:04 +0300 Subject: [PATCH] wallets now sorted as well as deduplicated --- core/views/scans.py | 6 ++++-- templates/cavewallets.html | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/views/scans.py b/core/views/scans.py index e3279f3..770b925 100644 --- a/core/views/scans.py +++ b/core/views/scans.py @@ -72,13 +72,15 @@ def allwallets(request): def cavewallets(request, cave_id): '''Returns all the wallets for just one cave, ''' + Gcavelookup = GetCaveLookup() if cave_id in Gcavelookup: cave = Gcavelookup[cave_id] else: return render(request,'errors/badslug.html', {'badslug': cave_id}) - print(f'cavewallets {cave_id=} {cave=}') + # remove duplication. SOrting is done in the template + wallets = set(Wallet.objects.filter(survexblock__survexfile__cave=cave)) + manywallets = list(wallets) - manywallets = set(Wallet.objects.filter(survexblock__survexfile__cave=cave)) return render(request, 'cavewallets.html', { 'manywallets':manywallets, 'settings': settings, 'cave': cave}) diff --git a/templates/cavewallets.html b/templates/cavewallets.html index cc5e1f1..2cbce29 100644 --- a/templates/cavewallets.html +++ b/templates/cavewallets.html @@ -12,7 +12,7 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c -{% for scanswallet in manywallets %} +{% for scanswallet in manywallets|dictsort:"walletname" %}
Scans folderFilesSurvex blocksCave
{{scanswallet.walletname}} {{scanswallet.singlescan_set.all|length}}