Add caching for user basic info

This commit is contained in:
cuom1999 2023-10-10 19:37:36 -05:00
parent 7f854c40dd
commit ed287b6ff3
15 changed files with 110 additions and 33 deletions

View file

@ -157,14 +157,14 @@ def item_title(item):
@registry.render_with("user/link.html")
def link_user(user):
if isinstance(user, Profile):
user, profile = user.user, user
profile = user
elif isinstance(user, AbstractUser):
profile = user.profile
elif type(user).__name__ == "ContestRankingProfile":
user, profile = user.user, user
profile = user
else:
raise ValueError("Expected profile or user, got %s" % (type(user),))
return {"user": user, "profile": profile}
return {"profile": profile}
@registry.function