當前位置: 首頁>>代碼示例>>Python>>正文


Python Job.wm_import方法代碼示例

本文整理匯總了Python中job.models.Job.wm_import方法的典型用法代碼示例。如果您正苦於以下問題:Python Job.wm_import方法的具體用法?Python Job.wm_import怎麽用?Python Job.wm_import使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在job.models.Job的用法示例。


在下文中一共展示了Job.wm_import方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: wm_import_job

# 需要導入模塊: from job.models import Job [as 別名]
# 或者: from job.models.Job import wm_import [as 別名]
 def wm_import_job(self):
   for job in Job.objects.all():
     job.delete()
   wm_jobs = WorkflowmaxJob.objects.all(datetime.now() - timedelta(days=365), datetime.now() + timedelta(days=365))
   for wm_job in wm_jobs:
     job = Job()
     job.wm_import(wm_job)
開發者ID:pombredanne,項目名稱:xscheduling,代碼行數:9,代碼來源:wm_import.py

示例2: import_jobs

# 需要導入模塊: from job.models import Job [as 別名]
# 或者: from job.models.Job import wm_import [as 別名]
def import_jobs(request):
  context_vars = dict()
  context_vars['header'] = capfirst(_('import jobs from workflowmax'))
  context_vars['comment'] = capfirst(_('this will destroy all your local jobs, please confirm your decision.'))
  if request.method == "POST":
    try:
      for job in Job.objects.all():
        job.delete()
      wm_jobs = WorkflowmaxJob.objects.all(datetime.now() - timedelta(days=365), datetime.now() + timedelta(days=365))
  #    wm_jobs = WorkflowmaxJob.objects.current()
      for wm_job in wm_jobs:
        job = Job()
        job.wm_import(wm_job)
      messages.success(request, capfirst(_('jobs were imported successfully')), fail_silently=True)
      return HttpResponseRedirect(reverse('job-list'))
    except NoInitialData, e:
      context_vars['error'] = capfirst(e)
開發者ID:pombredanne,項目名稱:xscheduling,代碼行數:19,代碼來源:views.py


注:本文中的job.models.Job.wm_import方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。