Show just surnames for an unnamed family, not "... family"

An unnamed family with distinct member surnames read as "Jones / Smith
family" -- dropping the suffix reads more like an actual family name.
This commit is contained in:
2026-08-03 17:04:09 +02:00
parent d5f45c9404
commit 2c4d031050
2 changed files with 2 additions and 2 deletions

View File

@@ -19,7 +19,7 @@ class Family(UUIDModel):
return self.name
surnames = sorted({last_name for last_name in self.memberships.values_list("member__last_name", flat=True) if last_name})
if surnames:
return _("%(surnames)s family") % {"surnames": " / ".join(surnames)}
return _("%(surnames)s") % {"surnames": " / ".join(surnames)}
return _("Family %(id)s") % {"id": str(self.pk)[:8]}
@property

View File

@@ -87,7 +87,7 @@ class FamilyNameOptionalTests(TestCase):
FamilyMembership.objects.create(family=family, member=jones, role=FamilyMembership.FamilyRole.CHILD)
# Distinct surnames, alphabetically ordered.
self.assertEqual(str(family), "Jones / Smith family")
self.assertEqual(str(family), "Jones / Smith")
def test_str_falls_back_to_short_id_when_empty(self):
family = Family.objects.create()