2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 14:51:51 +00:00

All working except floklist script

This commit is contained in:
Philip Sargent 2023-10-01 16:10:17 +03:00
parent 7b8703dadc
commit d8aad0ba2b
4 changed files with 10 additions and 5 deletions

View File

@ -95,6 +95,7 @@ class Person(TroggleModel):
def get_absolute_url(self):
# we do not use URL_ROOT any more.
return reverse("person", kwargs={"slug": self.slug})
return reverse("person", kwargs={"first_name": self.first_name, "last_name": self.last_name})
class Meta:

View File

@ -184,11 +184,14 @@ def better_person(request, name=""):
def person(
request,
first_name="",
last_name="",
slug=""
):
"""Original code as it has been for years. Trying to replace with better_person()
"""Original code as it has been for years. Trying to replace with better_person
"""
this_person = Person.objects.get(slug=slug)
return render(request, "person.html", {"person": this_person})
try:
this_person = Person.objects.get(first_name=first_name, last_name=last_name)
except:

View File

@ -20,7 +20,7 @@
{% endfor %}
</p>
<p>Status of all wallets for <b>
<a href="/wallets/person/{{personexpedition.person.first_name|safe}}{{personexpedition.person.last_name|safe}}">{{personexpedition.person.fullname}}</a>
<a href="/wallets/person/{{personexpedition.person.slug}}">{{personexpedition.person.fullname}}</a>
</b>
</p>
<h3>Table of all trips and surveys aligned by date</h3>

View File

@ -123,7 +123,8 @@ trogglepatterns = [
# Persons - nasty surname recognition logic fails for 19 people! See also Wallets by person below.
# path('person/<str:name>', person, name="person"), # This is much more complex than it looks..
re_path(r'^person/(?P<first_name>[A-Z]*[a-z\-\'&;]*)[^a-zA-Z]*(?P<last_name>[a-z\-\']*[^a-zA-Z]*[\-]*[A-Z]*[a-zA-Z\-&;]*)/?', person, name="person"),
path('person/<slug:slug>', person, name="person"),
#re_path(r'^person/(?P<first_name>[A-Z]*[a-z\-\'&;]*)[^a-zA-Z]*(?P<last_name>[a-z\-\']*[^a-zA-Z]*[\-]*[A-Z]*[a-zA-Z\-&;]*)/?', person, name="person"),
#re_path(r'^personexpedition/(?P<first_name>[A-Z]*[a-z&;]*)[^a-zA-Z]*(?P<last_name>[A-Z]*[a-zA-Z&;]*)/(?P<year>\d+)/?$', personexpedition, name="personexpedition"),
path('personexpedition/<slug:slug>/<int:year>', personexpedition, name="personexpedition"),