[Answer]-Django โ€“ Render view on user_logged_out signal

1๐Ÿ‘

A signal handler is not a view, it cannot render/return a response.

You could simply handle logic in your own view, and call or redirect to the auth logout function from there. Something like below..

from django.shortcuts import redirect

def my_logout(request):
    kwargs = {}
    if my_condition:
        kwargs['template_name'] = 'my_template.html'
        kwargs['extra_context'] = ...
    return redirect('logout', **kwargs)
๐Ÿ‘คuser4677819

0๐Ÿ‘

Found a clever solution allowing a redirect from anywhere, if you really need to. https://djangosnippets.org/snippets/2541/

๐Ÿ‘คDavid

Leave a comment