Skip to main content

get_user

Returns the user model instance associated with the given request, caching the result on the request object to prevent redundant authentication lookups.

def get_user(
request: HttpRequest
) - > User

Retrieves the user object associated with the given request, utilizing an internal cache to avoid redundant authentication lookups.

Parameters

NameTypeDescription
requestHttpRequestThe incoming HTTP request object used to retrieve or store the cached user instance.

Returns

TypeDescription
UserThe authenticated user instance associated with the current request.