pytask/taskapp/utils.py
author Nishanth Amuluru <nishanth@fossee.in>
Sun, 09 Jan 2011 19:45:42 +0530
changeset 129 13e171f09941
parent 106 aa61ea9c29f9
child 132 1be4a3c09a47
permissions -rw-r--r--
added unpublished tasks to home_page
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
105
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     1
from pytask.taskapp.models import Task
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     2
from django.http import Http404
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     3
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     4
def getTask(tid):
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     5
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     6
    try:
106
aa61ea9c29f9 now deleted tasks are also selected in db query
Nishanth Amuluru <nishanth@fossee.in>
parents: 105
diff changeset
     7
        task = Task.objects.get(uniq_key=tid)
105
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     8
        return task
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
     9
    except Task.DoesNotExist:
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    10
        raise Http404
94dd9d25d52a Added utils to taskapp
Nishanth Amuluru <nishanth@fossee.in>
parents:
diff changeset
    11