Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>browsing to stackoverflow... (did another search)</p> <p>I found this one: .... see <a href="https://stackoverflow.com/questions/11241080/django-contrib-auth-logout-in-django">django.contrib.auth.logout in Django</a> .. </p> <p>But is is even worse.... I found this... astonished... but explains it all: <a href="https://stackoverflow.com/questions/11933361/django-logout-url-doesnt-redirect-well">Django, Logout_URL doesn&#39;t redirect well</a></p> <p>The I found out it's a won't fix bug (@##$%%) not allowed to curse on christmas eve....</p> <p>So the solution to do my custom stuff is in the signals in stead of using my own view. Do the default view and redirect... and use this documentation to create a signal.. <a href="https://docs.djangoproject.com/en/dev/topics/auth/#login-and-logout-signals" rel="nofollow noreferrer">https://docs.djangoproject.com/en/dev/topics/auth/#login-and-logout-signals</a></p> <p>Adding the signals is quite easy, i put it in models.py off my main app (iamapps):</p> <pre><code>import logging from django.contrib.auth.signals import user_logged_out from django.contrib.auth.signals import user_logged_in logger = logging.getLogger(__name__) def iam_logged_out_actions(sender, user, request, **kwargs): #whatever... logger.debug("Logging out: user = %s" % user) user_logged_out.connect(iam_logged_out_actions) def iam_logged_in_actions(sender, user, request, **kwargs): #whatever... logger.debug("Logging in: user = %s" % user) user_logged_in.connect(iam_logged_in_actions) </code></pre> <p>This works....however it does not solve the broken pipe which I think might cause the failure on the logging out... so logging out in firefox still fails... and in chrome it works... Logging out from django admin page works in firefox.. and the signal has another pro: also from logging out in the admin interface, the signal is being called...</p> <p>for logging out i use now this urls.py:</p> <pre><code> url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}, name='iamapps.logout'), </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload