docs: Fix get_user function in caching documentation.

This commit fixes the get_user function code to be same
as that of the original function in models.py.
This commit is contained in:
Sahil Batra 2023-07-21 15:13:44 +05:30 committed by Tim Abbott
parent 592d0e2794
commit c843600d76
1 changed files with 3 additions and 2 deletions

View File

@ -68,8 +68,9 @@ def user_profile_cache_key(email: str, realm: "Realm") -> str:
@cache_with_key(user_profile_cache_key, timeout=3600 * 24 * 7)
def get_user(email: str, realm: Realm) -> UserProfile:
return UserProfile.objects.select_related().get(
email__iexact=email.strip(), realm=realm)
return UserProfile.objects.select_related("realm", "bot_owner").get(
email__iexact=email.strip(), realm=realm
)
```
This decorator implements a pretty classic caching paradigm: