#NEWLINE# def get_default_redirect( request , fallback_url = settings . LOGIN_REDIRECT_URL , redirect_field_name = 'next' , session_key_value = 'redirect_to' ) : #NEWLINE# #INDENT# '\n   Returns the URL to be used in login procedures by looking at different\n   values in the following order:\n\n   - a REQUEST value, GET or POST, named "next" by default.\n   - LOGIN_REDIRECT_URL - the URL in the setting\n   - LOGIN_REDIRECT_URLNAME - the name of a URLconf entry in the settings\n   ' #NEWLINE# redirect_to = request . REQUEST . get ( redirect_field_name ) #NEWLINE# if ( not redirect_to ) : #NEWLINE# #INDENT# if hasattr ( request , 'session' ) : #NEWLINE# #INDENT# redirect_to = request . session . get ( session_key_value ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( not redirect_to ) or ( '://' in redirect_to ) or ( ' ' in redirect_to ) ) : #NEWLINE# #INDENT# redirect_to = fallback_url #NEWLINE# #UNINDENT# return redirect_to