#NEWLINE# def delete( request , role_id ) : #NEWLINE# #INDENT# 'Delete a role' #NEWLINE# role = get_object_or_404 ( ProjectRole , pk = role_id ) #NEWLINE# project = role . project #NEWLINE# must_have_permission ( request . user , project , 'can_edit_roles' ) #NEWLINE# if ( ( role . name == 'owner' ) or ( role . name == 'researcher' ) ) : #NEWLINE# #INDENT# return simple . direct_to_template ( role_id , template = ( TEMPLATE_PATH + '/delete_default.html' ) , extra_context = { #NEWLINE# #INDENT# 'role' : role , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# role . delete ( ) #NEWLINE# return HttpResponseRedirect ( reverse ( 'project_detail' , args = [ project . id ] ) ) #NEWLINE# #UNINDENT# return simple . direct_to_template ( request , template = ( TEMPLATE_PATH + '/delete.html' ) , extra_context = { #NEWLINE# #INDENT# 'breadcrumbs' : ( ( 'Home' , reverse ( 'home' ) ) , ( ( 'Project %s' % role . project . name ) , reverse ( 'project_detail' , args = [ role . project . id ] ) ) , ( ( 'Delete Role %s' % role . name ) , request . path ) ) , #NEWLINE# 'role' : role , #NEWLINE# #UNINDENT# } )