pytask/taskapp/utils.py
changeset 414 a052c9ffa27d
parent 413 49b58b9b10a1
child 415 c631194cec2a
equal deleted inserted replaced
413:49b58b9b10a1 414:a052c9ffa27d
     1 from pytask.taskapp.models import Task, TextBook
       
     2 from django.http import Http404
       
     3 
       
     4 def getTask(tid):
       
     5 
       
     6     try:
       
     7         task = Task.objects.get(uniq_key=tid)
       
     8         return task
       
     9     except Task.DoesNotExist:
       
    10         raise Http404
       
    11 
       
    12 def getTextBook(tid):
       
    13 
       
    14     try:
       
    15         task = TextBook.objects.get(uniq_key=tid)
       
    16         return task
       
    17     except TextBook.DoesNotExist:
       
    18         raise Http404
       
    19