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
- [Answer]-What is the best practice to remove my own tag's contents?
- [Answer]-Execute django admin action as a celery task
Source:stackexchange.com