diff --git a/core/models/troggle.py b/core/models/troggle.py index 0977f84..9175eb6 100644 --- a/core/models/troggle.py +++ b/core/models/troggle.py @@ -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: diff --git a/core/views/logbooks.py b/core/views/logbooks.py index 10a9bee..70fd89a 100644 --- a/core/views/logbooks.py +++ b/core/views/logbooks.py @@ -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: diff --git a/templates/personexpedition.html b/templates/personexpedition.html index 2b035eb..af50b7c 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}}