Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I solved the problem by wrapping the django.contrib.auth.views.logout within a custom view and resetting the session language after logout. There's some code.</p> <p>I have an app named login with following urls.py:</p> <pre><code># myproject/login/urls.py from django.conf.urls.defaults import patterns urlpatterns = patterns('myproject.login.views', ... (r'^logout/$', 'logoutAction'), ... ) </code></pre> <p>So now URL /logout/ calls a view named logoutAction in views.py. In logoutAction, the old language code is stored temporarily and inserted back to the session after calling Django's contrib.auth.views.logout.</p> <pre><code># myproject/login/views.py ... from django.contrib.auth.views import logout as auth_logout def logoutAction(request): # Django auth logout erases all session data, including the user's # current language. So from the user's point of view, the change is # somewhat odd when he/she arrives to next page. Lets try to fix this. # Store the session language temporarily if the language data exists. # Its possible that it doesn't, for example if session middleware is # not used. Define language variable and reset to None so it can be # tested later even if session has not django_language. language = None if hasattr(request, 'session'): if 'django_language' in request.session: language = request.session['django_language'] # Do logout. This erases session data, including the locale language and # returns HttpResponseRedirect to the login page. In this case the login # page is located at '/' response = auth_logout(request, next_page='/') # Preserve the session language by setting it again. The language might # be None and if so, do nothing special. if language: request.session['django_language'] = language # Now user is happy. return response </code></pre> <p>The end of the LAN Quake problem :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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