def METHOD_NAME(request):
  if request.method != 'POST':
    raise PopupException(_('POST request required.'))
  ids = request.POST.get('ids').split(",")
  for script_id in ids:
    try:
      pig_script = PigScript.objects.get(id=script_id)
      pig_script.can_edit_or_exception(request.user)
      pig_script.doc.all().METHOD_NAME()
      pig_script.METHOD_NAME()
    except:
      LOG.exception('failed to delete pig script')
      None
  response = {
    'ids': ids,
  }
  return JsonResponse(response, content_type="text/plain")