taskapp/events/task.py
changeset 21 c28774fe7ffd
parent 19 c52f7cde9861
child 25 c0e4fc8b8b5b
equal deleted inserted replaced
20:ec7b1751c161 21:c28774fe7ffd
    19     """ creates a bare minimum task with title, description and credits.
    19     """ creates a bare minimum task with title, description and credits.
    20     the creator of the task will be assigned as a mentor for the task.
    20     the creator of the task will be assigned as a mentor for the task.
    21     """
    21     """
    22 
    22 
    23     try:
    23     try:
    24         task = Task.objects.get(title=title)
    24         task = Task.objects.get(title__iexact=title)
    25         return None
    25         return None
    26     except Task.DoesNotExist:
    26     except Task.DoesNotExist:
    27         task = Task(title=title)
    27         task = Task(title=title)
    28     task.desc = desc
    28     task.desc = desc
    29     task.created_by = created_by
    29     task.created_by = created_by
    30     task.credits = credits
    30     task.credits = credits
    31     task.creation_datetime = datetime.now()
    31     task.creation_datetime = datetime.now()
    32     task.save()
    32     task.save()
    33     return task
    33     return task
    34 
    34 
       
    35 def addSubTask(main_task, sub_task):
       
    36     """ add sub_task to subs list of main_task """
       
    37     
       
    38     main_task.subs.add(sub_task)
       
    39     main_task.status = "LO"
       
    40     main_task.save()
       
    41     return main_task