From 21e0700b8d12d73c084e1774bb648d150b32fd09 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 4 Oct 2023 13:05:33 +0300 Subject: [PATCH] CLean up accented names display --- core/views/logbooks.py | 24 +++++++++++++----------- templates/personexpedition.html | 2 +- templates/personwallets.html | 2 +- 3 files changed, 15 insertions(+), 13 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): diff --git a/templates/personexpedition.html b/templates/personexpedition.html index af50b7c..a9f05b9 100644 --- a/templates/personexpedition.html +++ b/templates/personexpedition.html @@ -20,7 +20,7 @@ {% endfor %}

Status of all wallets for -{{personexpedition.person.fullname}} +{{personexpedition.person.fullname|safe}}

Table of all trips and surveys aligned by date

diff --git a/templates/personwallets.html b/templates/personwallets.html index f74c231..d8577ee 100644 --- a/templates/personwallets.html +++ b/templates/personwallets.html @@ -3,7 +3,7 @@ {% block title %}One Person Survey scans folders (wallets){% endblock %} {% block content %} -

Wallets for {{person.fullname}}

+

Wallets for {{person.fullname|safe}}

Each wallet contains the scanned original in-cave survey notes and sketches of plans and elevations. It also contains scans of centre-line survex output on which hand-drawn passage sections are drawn. These hand-drawn passages will eventually be