From 4109dbf95e9b0fc14c423c0917a6fd19a7a4142f Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sat, 29 Oct 2011 13:58:41 +0000 Subject: [PATCH] Working on names svn: r18382 --- src/webapp/grampsdb/views.py | 4 ++-- src/webapp/utils.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/webapp/grampsdb/views.py b/src/webapp/grampsdb/views.py index 892d4d5f2..c79516630 100644 --- a/src/webapp/grampsdb/views.py +++ b/src/webapp/grampsdb/views.py @@ -439,8 +439,8 @@ def view_person_detail(request, view, handle, action="view"): except: name = Name(person=person, preferred=True) primary_surname = name.surname_set.get(primary=True) - default_data = {"surname": primary_surname.surname, - "prefix": primary_surname.prefix, + default_data = {"surname": "XX" or primary_surname.surname, + "prefix": primary_surname.prefix or "prefix", "suffix": name.suffix or "suffix", "first_name": name.first_name, "name_type": name.name_type, diff --git a/src/webapp/utils.py b/src/webapp/utils.py index 2116fff87..368487aa2 100644 --- a/src/webapp/utils.py +++ b/src/webapp/utils.py @@ -522,7 +522,10 @@ def render(formfield, user, action, test=False, truetext=""): if action == "view": if (not user.is_authenticated() and not test) or user.is_authenticated(): fieldname = formfield.name # 'surname' - retval = str(getattr(formfield.form.model, fieldname)) + try: + retval = str(getattr(formfield.form.model, fieldname)) + except: + retval = "???" # formfield._data() else: retval = truetext else: