pytask/taskapp/utils.py
changeset 370 1be4a3c09a47
parent 344 aa61ea9c29f9
equal deleted inserted replaced
369:602a909e9e16 370:1be4a3c09a47
     1 from pytask.taskapp.models import Task
     1 from pytask.taskapp.models import Task, TextBook
     2 from django.http import Http404
     2 from django.http import Http404
     3 
     3 
     4 def getTask(tid):
     4 def getTask(tid):
     5 
     5 
     6     try:
     6     try:
     7         task = Task.objects.get(uniq_key=tid)
     7         task = Task.objects.get(uniq_key=tid)
     8         return task
     8         return task
     9     except Task.DoesNotExist:
     9     except Task.DoesNotExist:
    10         raise Http404
    10         raise Http404
    11 
    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