当前位置: 首页>>代码示例>>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;未经允许,请勿转载。