summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-07-21 11:10:04 +0300
committerPhilip Sargent <philip.sargent@klebos.com>2022-07-21 11:10:04 +0300
commitf895a7e44c17cf22b239145372303f110bba3571 (patch)
tree75b3c17a43633368a58b6ae1041dc4776477e350
parent5161fce32e1f7f040ade2b4d8cfb859ae3ba2a0b (diff)
downloadtroggle-f895a7e44c17cf22b239145372303f110bba3571.tar.gz
troggle-f895a7e44c17cf22b239145372303f110bba3571.tar.bz2
troggle-f895a7e44c17cf22b239145372303f110bba3571.zip
wallets now sorted as well as deduplicated
-rw-r--r--core/views/scans.py6
-rw-r--r--templates/cavewallets.html2
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
<table width=95%>
<tr><th>Scans folder</th><th>Files</th><th>Survex blocks</th><th>Cave</th></tr>
-{% for scanswallet in manywallets %}
+{% for scanswallet in manywallets|dictsort:"walletname" %}
<tr>
<td style="padding:2px"><a href="{{scanswallet.get_absolute_url}}">{{scanswallet.walletname}}</a></td>
<td align="right" style="padding:2px">{{scanswallet.singlescan_set.all|length}}</td>