Ticket #11223: views.py.diff

File views.py.diff, 1.6 KB (added by Brandon M Height, 14 years ago)
  • django/contrib/auth/views.py

    diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py
    index c34a4a3..1170b65 100644
    a b def logout(request, next_page=None,  
    7474    "Logs out the user and displays 'You are logged out' message."
    7575    from django.contrib.auth import logout
    7676    logout(request)
     77    redirect_to = request.REQUEST.get(redirect_field_name, '')
     78    if redirect_to:
     79        return HttpResponseRedirect(redirect_to)
     80   
    7781    if next_page is None:
    78         redirect_to = request.REQUEST.get(redirect_field_name, '')
    79         if redirect_to:
    80             return HttpResponseRedirect(redirect_to)
    81         else:
    82             current_site = get_current_site(request)
    83             context = {
    84                 'site': current_site,
    85                 'site_name': current_site.name,
    86                 'title': _('Logged out')
    87             }
    88             context.update(extra_context or {})
    89             return render_to_response(template_name, context,
    90                                       context_instance=RequestContext(request, current_app=current_app))
     82        current_site = get_current_site(request)
     83        context = {
     84            'site': current_site,
     85            'site_name': current_site.name,
     86            'title': _('Logged out')
     87        }
     88        context.update(extra_context or {})
     89        return render_to_response(template_name, context,
     90                                  context_instance=RequestContext(request, current_app=current_app))
    9191    else:
    9292        # Redirect to this page until the session has been cleared.
    9393        return HttpResponseRedirect(next_page or request.path)
Back to Top