2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

wallets now sorted as well as deduplicated

This commit is contained in:
Philip Sargent 2022-07-21 11:10:04 +03:00
parent 5161fce32e
commit f895a7e44c
2 changed files with 5 additions and 3 deletions

View File

@ -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})

View File

@ -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>