@login_required
@require_http_methods(['GET', 'POST'])
def remove_contributor(request, document_slug, user_id):
 document = get_object_or_404(Document, locale=request.LANGUAGE_CODE, slug=document_slug)
 if (not document.allows(request.user, 'edit')):
  raise PermissionDenied
 user = get_object_or_404(User, id=user_id)
 if (request.method == 'POST'):
  document.contributors.remove(user)
  msg = _('{user} removed from the contributors successfully!').format(user=user.username)
  messages.add_message(request, messages.SUCCESS, msg)
  return HttpResponseRedirect(reverse('wiki.document_revisions', args=[document_slug]))
 return render(request, 'wiki/confirm_remove_contributor.html', {'document': document, 'contributor': user})

@ login_required @ require_http_methods ( [ 'GET' , 'POST' ] ) def remove_contributor ( request , document_slug , user_id ) : document = get_object_or_404 ( Document , locale = request . LANGUAGE_CODE , slug = document_slug ) if ( not document . allows ( request . user , 'edit' ) ) : raise PermissionDenied user = get_object_or_404 ( User , id = user_id ) if ( request . method == 'POST' ) : document . contributors . remove ( user ) msg = _ ( '{user} removed from the contributors successfully!' ) . format ( user = user . username ) messages . add_message ( request , messages . SUCCESS , msg ) return HttpResponseRedirect ( reverse ( 'wiki.document_revisions' , args = [ document_slug ] ) ) return render ( request , 'wiki/confirm_remove_contributor.html' , { 'document' : document , 'contributor' : user } )
remove a contributor from a document .