diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2021-04-20 22:58:41 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2021-04-20 22:58:41 +0100 |
commit | b4ba3c40ebf26cae49e93f2aa6c2f1b6e8bc556e (patch) | |
tree | 7229549717eb2492dfb0afce5e42bd83f4dd231e /core/views/logbooks.py | |
parent | 3b0c6ef2ea27fa2edbf5044f03e2dd3884ae54f5 (diff) | |
download | troggle-b4ba3c40ebf26cae49e93f2aa6c2f1b6e8bc556e.tar.gz troggle-b4ba3c40ebf26cae49e93f2aa6c2f1b6e8bc556e.tar.bz2 troggle-b4ba3c40ebf26cae49e93f2aa6c2f1b6e8bc556e.zip |
catch unknown scotsman error
Diffstat (limited to 'core/views/logbooks.py')
-rw-r--r-- | core/views/logbooks.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/core/views/logbooks.py b/core/views/logbooks.py index 00ac4e4..4abe966 100644 --- a/core/views/logbooks.py +++ b/core/views/logbooks.py @@ -115,16 +115,13 @@ class Expeditions_jsonListView(ListView): def person(request, first_name='', last_name='', ): - this_person = Person.objects.get(first_name = first_name, last_name = last_name) + try: + this_person = Person.objects.get(first_name = first_name, last_name = last_name) + return render(request,'person.html', {'person': this_person, }) + except: + message = f'Person not found - possibly Scottish? (We have a name parser issue with Mc, Mac etc.)' + return render(request, 'errors/generic.html', {'message': message}) - # This is for removing the reference to the user's profile, in case they set it to the wrong person - if request.method == 'GET': - if request.GET.get('clear_profile')=='True': - this_person.user=None - this_person.save() - return HttpResponseRedirect(reverse('profiles_select_profile')) - - return render(request,'person.html', {'person': this_person, }) def get_person_chronology(personexpedition): |