summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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>