#NEWLINE# @ deprecate_current_app #NEWLINE# @ never_cache #NEWLINE# def logout( request , next_page = None , template_name = 'registration/logged_out.html' , redirect_field_name = REDIRECT_FIELD_NAME , extra_context = None ) : #NEWLINE# #INDENT# "\n    Logs out the user and displays 'You are logged out' message.\n    " #NEWLINE# auth_logout ( request ) #NEWLINE# if ( next_page is not None ) : #NEWLINE# #INDENT# next_page = resolve_url ( next_page ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if settings . LOGOUT_REDIRECT_URL : #NEWLINE# #INDENT# next_page = resolve_url ( settings . LOGOUT_REDIRECT_URL ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( redirect_field_name in request . POST ) or ( redirect_field_name in request . GET ) ) : #NEWLINE# #INDENT# next_page = request . POST . get ( redirect_field_name , request . GET . get ( redirect_field_name ) ) #NEWLINE# if ( not is_safe_url ( url = next_page , host = request . get_host ( ) ) ) : #NEWLINE# #INDENT# next_page = request . path #NEWLINE# #UNINDENT# #UNINDENT# if next_page : #NEWLINE# #INDENT# return HttpResponseRedirect ( next_page ) #NEWLINE# #UNINDENT# current_site = get_current_site ( request ) #NEWLINE# context = { #NEWLINE# #INDENT# 'site' : current_site , #NEWLINE# 'site_name' : current_site . name , #NEWLINE# 'title' : _ ( 'Logged out' ) , #NEWLINE# #UNINDENT# } #NEWLINE# if ( extra_context is not None ) : #NEWLINE# #INDENT# context . update ( extra_context ) #NEWLINE# #UNINDENT# return TemplateResponse ( request , template_name , context )