From 13b57d2bb6e82ed2b6d2c8716da91d47f3986df5 Mon Sep 17 00:00:00 2001
From: Philip Sargent <philip.sargent@klebos.com>
Date: Mon, 19 Sep 2022 21:54:32 +0300
Subject: [PATCH] year list for wallets by year

---
 core/views/scans.py        |  7 ++++---
 templates/yearwallets.html | 12 +++++++++++-
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/core/views/scans.py b/core/views/scans.py
index d8880e0..ceda72b 100644
--- a/core/views/scans.py
+++ b/core/views/scans.py
@@ -10,7 +10,7 @@ from django.shortcuts import render
 from django.http import HttpResponse
 
 from troggle.core.models.survex import Wallet, SingleScan, SurvexBlock
-from troggle.core.models.troggle import Person
+from troggle.core.models.troggle import Person, Expedition
 from troggle.core.models.caves import GetCaveLookup
 from troggle.core.views.expo import getmimetype
 #from troggle.parsers.people import GetPersonExpeditionNameLookup
@@ -161,8 +161,9 @@ def walletslistyear(request, year):
     #return render(request, 'errors/generic.html', {'message': 'This page logic not implemented yet'})   
 
     manywallets = ticksyearwallet(year)
- 
-    return render(request, 'yearwallets.html', { 'manywallets':manywallets, 'settings': settings, 'year': year})
+    expeditions = Expedition.objects.all()
+    expedition = Expedition.objects.filter(year=year)
+    return render(request, 'yearwallets.html', { 'manywallets':manywallets, 'settings': settings, 'year': year, 'expeditions': expeditions, 'expedition': expedition})
 
 
 
diff --git a/templates/yearwallets.html b/templates/yearwallets.html
index 03c4822..51a56c0 100644
--- a/templates/yearwallets.html
+++ b/templates/yearwallets.html
@@ -11,10 +11,20 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
 
 {% include 'wallet_new.html' %}
 
+
+
 <p>See also wallets
-<ul>
+<ul style="width: 78%">
 <li>per cave, e.g. <a href="/cave/scans/1623-161">1623/161</a>, <a href="/cave/scans/1623-290">1623/290</a>, <a href="/cave/scans/1623-291">1623/291</a>, <a href="/cave/scans/1623-264">1623/264</a>
 <li>per person, e.g. <a href="/wallets/person/Wookey">Wookey</a>, <a href="/wallets/person/ChrisDensham">Chris Densham</a>, <a href="/wallets/person/BeckaLawson">Becka</a>
+<li>other years:
+{% for otherexpedition in expeditions %}
+  {% if otherexpedition == expedition %}
+  | <b>{{otherexpedition.year}}</b>
+  {% else %}
+  | <a <a href="/wallets/year/{{ otherexpedition.year }}">{{otherexpedition.year}}</a>
+  {% endif %}
+{% endfor %}
 </ul>
 
 {% include 'wallet_table.html' %}