当前位置: 首页>>代码示例>>Python>>正文


Python Task.name方法代码示例

本文整理汇总了Python中tasks.models.Task.name方法的典型用法代码示例。如果您正苦于以下问题:Python Task.name方法的具体用法?Python Task.name怎么用?Python Task.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tasks.models.Task的用法示例。


在下文中一共展示了Task.name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_tasks

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import name [as 别名]
 def test_tasks(self):
     s = Supplier()
     s.name = 'Joe'
     s.save()
     
     p = Property()
     p.save()
     l = Location(property = p)
     l.save()
     a = Asset(location = l)
     a.save()         
     t = Task(asset = a)
     t.name = 'Mop floors'
     t.frequency = 1
     t.save()
      
     q = Quote(supplier = s)
     q.amount = 4
     q.save()
     
     self.assertEqual(0, len(q.tasks.all()))
     
     q.tasks.add(t)
     self.assertEqual(1, len(q.tasks.all()))
       
     self.assertEqual
     self.assertEqual("$4.00 to Mop floors (Joe)", str(q))
开发者ID:ianfp,项目名称:property,代码行数:29,代码来源:models.py

示例2: add_project_task

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import name [as 别名]
def add_project_task(request,slug):
    if request.user.is_authenticated():
        project = Project.objects.get(slug = slug)
        if request.POST:
            form = TaskForm(request.POST)
            if form.is_valid():
                data = form.cleaned_data
                td = data['end_date'] - data['start_date']
                if td.total_seconds()>0:
                    task = Task()
                    task.name = data['name']
                    task.description = data['description']
                    task.start_date = data['start_date']
                    task.end_date = data['end_date']
                    task.user = data['user']
                    task.project = project
                    task.save()
                else:
                    messages.add_message(request, messages.ERROR,
                        " end date is less than start date!")
                    return (redirect(reverse('Task:add_task')))
                return (redirect(reverse('Home:manager')))
            else:
                messages.add_message(request, messages.ERROR, 
                    "invalid form")
                return (redirect(reverse('Task:add_task')))
        else:
            form = TaskForm()
            send_dict={}
            context_instance=RequestContext(request)
            send_dict['project'] = project
            send_dict['form'] = form
            return render_to_response('tasks/add_task.html',send_dict,context_instance)
    else:
        return redirect(reverse('Login:login'))
开发者ID:Adikeshav,项目名称:intern,代码行数:37,代码来源:views.py

示例3: post

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import name [as 别名]
 def post(request):
     task = request.POST.get('task')
     new = Task()
     new.name = task
     new.status = Status.objects.get(name='New')
     new.save()
     response = HttpResponse()
     response.status_code = 201
     return response
开发者ID:ivegor,项目名称:trello,代码行数:11,代码来源:views.py

示例4: GET

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import name [as 别名]
    def GET(self):
        # if the task exists, retrieve it, or create it
        task_list = Task.objects.filter(name=self.__class__.__name__)
        if task_list:
            task = task_list[0]
        else:
            task = Task()
            task.name = self.__class__.__name__
            # ensure that the task will be executed
            self.flash(_(u"Update task postponed"))

        if not task.last_update or\
            datetime.now() - task.last_update > self.update_period:

            self.__execute(task)
            task.last_update = datetime.now()
            task.save()
            self.flash(_(u"Update task done"))
        else:
            self.flash(_(u"Update task postponed"))
        return redirect("/")
开发者ID:kalikaneko,项目名称:timebank,代码行数:23,代码来源:views.py

示例5: bulk_action

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import name [as 别名]
def bulk_action(request, project_id):

    if request.user.is_staff:
        project = get_object_or_404(Project, pk=project_id)
    else:
        project = get_object_or_404(Project, pk=project_id, user=request.user)

    if request.method == 'POST':
        
        action = request.POST['action']

        # print('POST', request.POST)

        model = request.POST['model']


        if model == 'files':
    
            files = request.POST.getlist('files')


            if action == 'analysis':

                request.session['files'] = files
                request.session['project_id'] = project_id
                
                return redirect('analysis-create')


            for file_id in files:
                file = File.objects.get(pk=file_id)
                if action == "delete":
                    file.delete()
                if action == "qc":
                    if file.file_type in ['fq', 'fastq', 'bam', 'vcf']:
                        task = Task()
                        task.name = 'QC ProjectFile %s' % (file.id)
                        task.type = 'qc'
                        task.action = 'qc'
                        task.status = 'new'
                        task.manifest = {
                            'input':file.location,
                            'project':project.id,
                            'file':file.id,
                            'type':'qc',
                        }
                        task.save()
                        run_qc.delay(task.id)
                if action == "check":
                   task_manifest = {}
                   task_manifest['file'] = file.id
                   task_manifest['action'] = action
                   task = Task(user=request.user)
                   task.manifest = task_manifest
                   task.status = 'new'
                   task.action = action
                   task.user = request.user
                   task.save()
                   check_file.delay(task.id)
                   file.status = 'scheduled'
                   file.save()







        if model == 'samples':
            samples = request.POST.getlist('samples')
            for sample_id in samples:
                sample = ProjectSample.objects.get(pk=sample_id)
                if action == "delete":
                    sample.delete()

            
    return redirect('projects-view', project_id=project_id)
开发者ID:raonyguimaraes,项目名称:mendelmd,代码行数:79,代码来源:views.py


注:本文中的tasks.models.Task.name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。