#NEWLINE# @ login_required #NEWLINE# @ require_http_methods ( [ 'GET' , 'POST' ] ) #NEWLINE# def remove_from_locale( request , locale_code , user_id , role ) : #NEWLINE# #INDENT# 'Remove a user from the locale role.' #NEWLINE# locale = get_object_or_404 ( Locale , locale = locale_code ) #NEWLINE# user = get_object_or_404 ( User , id = user_id ) #NEWLINE# if ( not _user_can_edit ( request . user , locale ) ) : #NEWLINE# #INDENT# raise PermissionDenied #NEWLINE# #UNINDENT# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# getattr ( locale , ROLE_ATTRS [ role ] ) . remove ( request ) #NEWLINE# msg = _ ( '{user} removed from successfully!' ) . format ( user = user . username ) #NEWLINE# messages . add_message ( request , messages . SUCCESS , msg ) #NEWLINE# return HttpResponseRedirect ( locale . get_absolute_url ( ) ) #NEWLINE# #UNINDENT# return render ( request , 'wiki/confirm_remove_from_locale.html' , { #NEWLINE# #INDENT# 'locale' : locale , #NEWLINE# 'leader' : user , #NEWLINE# 'role' : role , #NEWLINE# #UNINDENT# } )