summaryrefslogtreecommitdiffstats
path: root/core/views/logbooks.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-10-01 15:55:28 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2023-10-01 15:55:28 +0300
commit7b8703dadc654284daea4ec1cb263a3b17b1b041 (patch)
tree6a380e4d12ee39d57ba7b68d5e3d740ba52988d5 /core/views/logbooks.py
parent16d3ee9f92914859edd7b568c9dbd802fd93438e (diff)
downloadtroggle-7b8703dadc654284daea4ec1cb263a3b17b1b041.tar.gz
troggle-7b8703dadc654284daea4ec1cb263a3b17b1b041.tar.bz2
troggle-7b8703dadc654284daea4ec1cb263a3b17b1b041.zip
part-way though converting to slugs for people
Diffstat (limited to 'core/views/logbooks.py')
-rw-r--r--core/views/logbooks.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/views/logbooks.py b/core/views/logbooks.py
index d9e2192..10a9bee 100644
--- a/core/views/logbooks.py
+++ b/core/views/logbooks.py
@@ -193,6 +193,9 @@ def person(
this_person = Person.objects.get(first_name=first_name, last_name=last_name)
except:
message = f"Person not found '{first_name} {last_name}' - possibly Scottish? (See our <a href=\"/handbook/troggle/namesredesign.html\">Proposal to fix this</a>)"
+ peeps = Person.objects.filter(first_name=first_name, last_name=last_name)
+ if len(peeps) > 1:
+ message = f"Multiple people ({len(peeps)}) with this name '{first_name} {last_name}' - (See our <a href=\"/handbook/troggle/namesredesign.html\">Proposal to fix this</a>)"
return render(request, "errors/generic.html", {"message": message})
return render(request, "person.html", {"person": this_person})
@@ -232,8 +235,8 @@ def get_person_chronology(personexpedition):
return res2
-def personexpedition(request, first_name="", last_name="", year=""):
- person = Person.objects.get(first_name=first_name, last_name=last_name)
+def personexpedition(request, slug="", year=""):
+ person = Person.objects.get(slug=slug)
this_expedition = Expedition.objects.get(year=year)
personexpedition = person.personexpedition_set.get(expedition=this_expedition)
personchronology = get_person_chronology(personexpedition)