@handle_response_format
@treeio_login_required
@module_admin_required()
def user_delete(request, user_id, response_format='html'):
 profile = get_object_or_404(User, pk=user_id)
 message = ''
 if (profile == request.user.profile):
  message = _('This is you!')
 elif request.POST:
  if ('delete' in request.POST):
   profile.delete()
   return HttpResponseRedirect(reverse('core_admin_index_users'))
  elif ('cancel' in request.POST):
   return HttpResponseRedirect(reverse('core_admin_user_view', args=[profile.id]))
 return render_to_response('core/administration/user_delete', {'profile': profile, 'message': message}, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required @ module_admin_required ( ) def user_delete ( request , user_id , response_format = 'html' ) : profile = get_object_or_404 ( User , pk = user_id ) message = '' if ( profile == request . user . profile ) : message = _ ( 'This is you!' ) elif request . POST : if ( 'delete' in request . POST ) : profile . delete ( ) return HttpResponseRedirect ( reverse ( 'core_admin_index_users' ) ) elif ( 'cancel' in request . POST ) : return HttpResponseRedirect ( reverse ( 'core_admin_user_view' , args = [ profile . id ] ) ) return render_to_response ( 'core/administration/user_delete' , { 'profile' : profile , 'message' : message } , context_instance = RequestContext ( request ) , response_format = response_format )
delete a user cli examples: .