Ticket #10460: views.py.diff
File views.py.diff, 1.2 KB (added by , 16 years ago) |
---|
-
django/contrib/auth/views.py
42 42 }, context_instance=RequestContext(request)) 43 43 login = never_cache(login) 44 44 45 def logout(request, next_page=None, template_name='registration/logged_out.html' ):45 def logout(request, next_page=None, template_name='registration/logged_out.html', redirect_to=REDIRECT_FIELD_NAME): 46 46 "Logs out the user and displays 'You are logged out' message." 47 47 from django.contrib.auth import logout 48 48 logout(request) 49 49 if next_page is None: 50 return render_to_response(template_name, {'title': _('Logged out')}, context_instance=RequestContext(request)) 50 redirect_to = request.REQUEST.get(redirect_field_name, '') 51 if redirect_to: 52 return HttpResponseRedirect(redirect_to) 53 else: 54 return render_to_response(template_name, {'title': _('Logged out')}, context_instance=RequestContext(request)) 51 55 else: 52 56 # Redirect to this page until the session has been cleared. 53 57 return HttpResponseRedirect(next_page or request.path)