From a781d6d47894db119847eb0c05a868f12db8cec2 Mon Sep 17 00:00:00 2001 From: Kira Miller <31229189+kiram15@users.noreply.github.com> Date: Thu, 20 Jun 2024 11:53:26 -0600 Subject: [PATCH] fix: change in name property function (#2135) * fix: quick fix changing where we're pulling name * fix: test fixes * fix: version bump * fix: Update CHANGELOG.rst --- CHANGELOG.rst | 4 ++++ enterprise/__init__.py | 2 +- enterprise/models.py | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8defedf55..b257470e6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,6 +17,10 @@ Unreleased ---------- * nothing unreleased +[4.20.7] +-------- +* fix: add name from profile to group membership details + [4.20.6] -------- * refactor: Removes ``career_engagement_network_message`` from ``EnterpriseCustomer``. diff --git a/enterprise/__init__.py b/enterprise/__init__.py index c6ae17bf1..9f33053f3 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -2,4 +2,4 @@ Your project description goes here. """ -__version__ = "4.20.6" +__version__ = "4.20.7" diff --git a/enterprise/models.py b/enterprise/models.py index 93f754f2c..572d7c8ef 100644 --- a/enterprise/models.py +++ b/enterprise/models.py @@ -1145,6 +1145,10 @@ def user(self): except User.DoesNotExist: return None + @cached_property + def user_profile(self): + return getattr(self.user, 'profile', None) + @property def user_email(self): """ @@ -1168,7 +1172,9 @@ def name(self): """ Return linked user's name. """ - if self.user is not None: + if self.user_profile is not None: + return f"{self.user_profile.name}" + elif self.user is not None: return f"{self.user.first_name} {self.user.last_name}" return None