diff --git a/src/web/grampsdb/models.py b/src/web/grampsdb/models.py index e93d3b6f2..38c7a3ff8 100644 --- a/src/web/grampsdb/models.py +++ b/src/web/grampsdb/models.py @@ -445,7 +445,10 @@ class Person(PrimaryObject): """ Return the preferred name of a person. """ - return self.name_set.get(preferred=True) + try: + return self.name_set.get(preferred=True) + except: + return "" def __unicode__(self): return str(self.get_primary_name()) @@ -595,7 +598,10 @@ class Name(DateObject, SecondaryObject): _sanitized = False def get_primary_surname(self): - return self.surname_set.get(primary=True).surname + try: + return self.surname_set.get(primary=True).surname + except: + return "" def __unicode__(self): return "%s, %s" % (self.get_primary_surname(), @@ -615,7 +621,9 @@ class Name(DateObject, SecondaryObject): self.title = "" def make_surname_list(self): - return [] + return [(x.surname, x.prefix, x.primary, + tuple(x.name_origin_type), x.connector) for x in + self.surname_set.all()] class Lds(DateObject, SecondaryObject): """ diff --git a/src/web/libdjango.py b/src/web/libdjango.py index f725ec68e..569536b82 100644 --- a/src/web/libdjango.py +++ b/src/web/libdjango.py @@ -598,7 +598,6 @@ class DjangoInterface(object): self.add_event_ref(obj, event_ref) def add_surname_list(self, name, surname_list): - print surname_list, name for data in surname_list: (surname_text, prefix, primary, origin_type, connector) = data