diff --git a/judge/jinja2/gravatar.py b/judge/jinja2/gravatar.py index 373f685..b6e8a83 100644 --- a/judge/jinja2/gravatar.py +++ b/judge/jinja2/gravatar.py @@ -12,8 +12,8 @@ from . import registry def gravatar(profile, size=80, default=None, profile_image=None, email=None): if profile_image: return profile_image - if profile and profile.cached_profile_image: - return profile.cached_profile_image.url + if profile and profile.profile_image_url: + return profile.profile_image_url if profile: email = email or profile.email if default is None: diff --git a/judge/models/profile.py b/judge/models/profile.py index 05c5770..9f7b931 100644 --- a/judge/models/profile.py +++ b/judge/models/profile.py @@ -259,15 +259,18 @@ class Profile(models.Model): max_length=300, ) - @cache_wrapper(prefix="Pgbi") + @cache_wrapper(prefix="Pgbi2") def _get_basic_info(self): + profile_image_url = None + if self.profile_image: + profile_image_url = self.profile_image.url return { "first_name": self.user.first_name, "last_name": self.user.last_name, "email": self.user.email, "username": self.user.username, "mute": self.mute, - "profile_image": self.profile_image, + "profile_image_url": profile_image_url, } @cached_property @@ -301,8 +304,8 @@ class Profile(models.Model): return self._cached_info["mute"] @cached_property - def cached_profile_image(self): - return self._cached_info["profile_image"] + def profile_image_url(self): + return self._cached_info["profile_image_url"] @cached_property def count_unseen_notifications(self):