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


Python Task.subject方法代码示例

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


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

示例1: populate_db

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

#.........这里部分代码省略.........
            continue
        u = ERPUser()
        if User.objects.filter(username = '_super'+str(i)).count(): # user doesnt exist
            u.user = User.objects.get(username = '_super'+str(i))
        else:
            u.user = User.objects.create_user(
                username = '_super'+str(i), 
                password = str(i)
            )
        u.user.username = '_super'+str(i)
        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()
开发者ID:manikandandav,项目名称:test_dashboard_,代码行数:70,代码来源:test.py


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