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


Python Task.description方法代码示例

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


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

示例1: add_project_task

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import description [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

示例2: update

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import description [as 别名]
	def update(self, pk):
		try:
			task = Task.objects.get(pk=pk)
		except Task.DoesNotExist:
			task = Task()

		task.title = self.data['title']
		task.description = self.data['description']
		task.save()

		return task
开发者ID:fabiancabau,项目名称:task_admin,代码行数:13,代码来源:api.py

示例3: populate_db

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import description [as 别名]

#.........这里部分代码省略.........
        u.user.set_password(str(i))
        u.user.email = "super" + str(i) + "[email protected]",  
        u.user.first_name = "Super" + str(i)
        u.user.last_name = "ASuper"
        if Dept.objects.filter(name="Dept"+str(i%DEPT_RANGE)).count():
            u.dept = Dept.objects.get(name="Dept"+str(i%DEPT_RANGE))
        else:
            print "Error, there is no dept to assign the super to"
            return
        u.status = 1
        u.core_relations = u.dept
        u.nickname = "Supernick" + str(i)
        u.chennai_number = str(i%10)*10
        u.summer_number = str((i%100)/10)*10
        u.summer_stay = "full"
        u.hostel = HOSTEL_CHOICES[i%len(HOSTEL_CHOICES)][0]
        u.room_no = i%1000
        u.user.save()
        u.save()
    
    # MAKE INTRA DEPARTMENTAL TASKS - ACCEPTED
    print "Creating", INTRATASK_ACCEPTED_RANGE, "Intra dept tasks which are ACCEPTED"
    for i in range(INTRATASK_ACCEPTED_RANGE):
        if Task.objects.filter(subject="Subject for Intra approved Task" + str(i)).count():
            continue
        t = Task()
        if ERPUser.objects.filter(nickname="Corenick" + str(i%CORE_RANGE) ).count() :
            t.taskcreator = ERPUser.objects.get(nickname="Corenick" + str(i%CORE_RANGE) )
        else : 
            print "Error, there is no user", "Corenick" + str(i%CORE_RANGE) , "to assign the task to"
            return
        t.deadline = datetime.date.today() # date is in datetime
        t.subject = "Subject for Intra approved Task" + str(i)
        t.description = "This a description for this Task. It is task number " + str(i) + "."
        if Dept.objects.filter(name="Dept" + str(int(i%DEPT_RANGE)) ).count() :
            t.origindept = Dept.objects.get(name="Dept" + str(int(i%DEPT_RANGE)) )
            t.targetdept = t.origindept
        else :
            print "Error, there is no subdept", "Subdept" + str((i/DEPT_RANGE)%SUBDEPT_RANGE) + " for " + t.origindept.name , "to assign the task to"
            return
        # Subdepts in origin dept
        if Subdept.objects.filter(name="Subdept" + str((i/DEPT_RANGE)%SUBDEPT_RANGE) + " for " + t.origindept.name ).count():
            t.targetsubdept = Subdept.objects.get(name="Subdept" + str((i/DEPT_RANGE)%SUBDEPT_RANGE) + " for " + t.origindept.name )
        else:
            print "Error, there is no subdept", "Subdept" + str((i/DEPT_RANGE)%SUBDEPT_RANGE) + " for " + t.origindept.name , "to assign the task to"
            return
        t.save()
        # Intra, So Taskforce if from origin dept only.
        if ERPUser.objects.filter(dept__name=t.origindept.name ).count():
            t.taskforce = ERPUser.objects.filter(dept__name=t.origindept.name )
        else:
            print "Error, there is no taskforce in dept", t.origindept.name , "to assign the task to"
            return
        t.isxdepartmental = False
        t.taskstatus = 'O'
        t.save()
    
    # MAKE INTRA DEPARTMENTAL TASKS - NEARLY COMPLETE
    print "Creating", INTRATASK_NEARLY_RANGE, "Intra dept tasks which are NEARLY COMPLETED"
    for i in range(INTRATASK_NEARLY_RANGE):
        if Task.objects.filter(subject="Subject for Intra almost_complete Task" + str(i)).count():
            continue
        t = Task()
        if ERPUser.objects.filter(nickname="Corenick" + str(i%CORE_RANGE) ).count() :
            t.taskcreator = ERPUser.objects.get(nickname="Corenick" + str(i%CORE_RANGE) )
        else : 
开发者ID:manikandandav,项目名称:test_dashboard_,代码行数:70,代码来源:test.py


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