Skip to main content

get_user

Return the user model instance associated with the given request session. If no user is retrieved, return an instance of AnonymousUser.

def get_user(
request: HttpRequest
) - > User | AnonymousUser

Return the user model instance associated with the given request session. If no user is retrieved, return an instance of AnonymousUser.

Parameters

NameTypeDescription
requestHttpRequestThe current HTTP request object containing the session data used to identify the user.

Returns

TypeDescription
`UserAnonymousUser`