logout_then_login
Log out the user if they are logged in. Then redirect to the login page.
def logout_then_login(
request: HttpRequest,
login_url: string = None
) - > HttpResponse
Log out the user if they are logged in. Then redirect to the login page.
Parameters
| Name | Type | Description |
|---|---|---|
| request | HttpRequest | The current HTTP request object representing the user session to be terminated. |
| login_url | string = None | The URL or named URL pattern to redirect the user to after logout; defaults to the LOGIN_URL setting if not provided. |
Returns
| Type | Description |
|---|---|
HttpResponse | A redirect response that sends the user to the specified login URL after terminating their session. |