summaryrefslogtreecommitdiffstats
path: root/core/views/logbooks.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-10-04 13:05:33 +0300
committerPhilip Sargent <philip.sargent@gmail.com>2023-10-04 13:05:33 +0300
commit21e0700b8d12d73c084e1774bb648d150b32fd09 (patch)
tree32d3b047e07a97a94f1f399f2e459d5983fd8b5b /core/views/logbooks.py
parentad2d25ed0059ae5cf94946f267703586ce413753 (diff)
downloadtroggle-21e0700b8d12d73c084e1774bb648d150b32fd09.tar.gz
troggle-21e0700b8d12d73c084e1774bb648d150b32fd09.tar.bz2
troggle-21e0700b8d12d73c084e1774bb648d150b32fd09.zip
CLean up accented names display
Diffstat (limited to 'core/views/logbooks.py')
-rw-r--r--core/views/logbooks.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/core/views/logbooks.py b/core/views/logbooks.py
index 308061c..cd39ab6 100644
--- a/core/views/logbooks.py
+++ b/core/views/logbooks.py
@@ -152,12 +152,9 @@ class Expeditions_jsonListView(ListView):
class QMs_jsonListView(ListView):
template_name = "core/QMs_json_list.html"
model = QM
-
-rx_person = re.compile(r"(?i)^(([A-Z]*[a-z\-\'&;]*)[^a-zA-Z]*)([a-z\-\']*[^a-zA-Z]*[\-]*[A-Z]*[a-zA-Z\-&;]*)$")
-rx_simple_person = re.compile(r"^([A-Z][a-z]*)[ ]*([A-Z][a-z]*)$")
def person(request, slug=""):
- """Original code as it has been for years. Trying to replace with better_person
+ """Now very much simpler with an unambiguous slug
"""
this_person = Person.objects.get(slug=slug)
return render(request, "person.html", {"person": this_person})
@@ -197,14 +194,19 @@ def get_person_chronology(personexpedition):
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)
+ try:
+ 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)
- return render(
- request, "personexpedition.html", {"personexpedition": personexpedition, "personchronology": personchronology}
- )
+ return render(
+ request, "personexpedition.html", {"personexpedition": personexpedition, "personchronology": personchronology}
+ )
+ except:
+ msg = f" Person '{slug=}' or year '{year=}' not found in database. Please report this to a nerd."
+ print(msg)
+ return render(request, "errors/generic.html", {"message": msg})
def logbookentry(request, date, slug):