# Path: pytask/helpers/exceptions.py
# DEFAULT_ERROR_MESSAGE = ugettext(
#   "There was some error in your request.")
# DEFAULT_LOGIN_MESSAGE = ugettext(
#   "You have to login to view this page.")
# class PyTaskException(Exception):
# class UnauthorizedAccess(PyTaskException):
#     def __init__(self, message=None, **response_args):
#     def __init__(self, message=None, **response_args):
# 
# Path: pytask/views.py
# def show_msg(user, message, redirect_url=None, url_desc=None):
#     """ simply redirect to homepage """
# 
#     context = {
#       'user': user,
#       'message': message,
#       'redirect_url': redirect_url,
#       'url_desc': url_desc
#     }
# 
#     return render_to_response('show_msg.html', context)
# 
# Path: pytask/profile/models.py
# GENDER_CHOICES = (
#   ('Male', 'Male'),
#   ('Female', 'Female'),
# )
# ROLES_CHOICES = (
#   ("Administrator", "Administrator"),
#   ("Coordinator", "Coordinator"),
#   ("Mentor", "Mentor"),
#   ("Contributor", "Contributor"),
# )
# ROLE_CHOICES = (
#   ("Administrator", "Request sent by Administrator \
#     to a user at lower level, asking him to act as a administrator"),
#   ("Coordinator", "Request sent by Coordinator \
#     to a user at lower level, asking him to act as a coordinator"),
# )
# class Profile(models.Model):
# class Notification(models.Model):
# class RoleRequest(models.Model):
#     def __unicode__(self):
# 
# Path: pytask/taskapp/forms.py
# class CreateTaskForm(forms.ModelForm):
#     class Meta:
# class EditTaskForm(forms.ModelForm):
#     class Meta:
# class TaskCommentForm(forms.ModelForm):
#     class Meta:
# class ClaimTaskForm(forms.ModelForm):
#     class Meta:
#     class myform(forms.Form):
# class CreateTextbookForm(forms.ModelForm):
#     class Meta:
# class CreateChapterForm(forms.ModelForm):
#     class Meta:
# class EditTextbookForm(forms.ModelForm):
#     class Meta:
#     class myForm(forms.Form):
#     class myForm(forms.Form):
#     class myForm(forms.Form):
# class WorkReportForm(forms.ModelForm):
#     class Meta:
#     def clean_title(self):
#     def clean_desc(self):
#     def clean_tags_field(self):
#     def clean_desc(self):
#     def clean_title(self):
#     def clean_tags_field(self):
#     def clean_data(self):
#     def clean_proposal(self):
# def ChoiceForm(choices, data=None, label="choice"):
#     def clean_tags_field(self):
#     def clean_tags_field(self):
#     def clean_tags_field(self):
# def AddTaskForm(task_choices, is_plain=False):
# def AssignPyntForm(choices, instance=None):
# def RemoveUserForm(choices, instance=None):
# 
# Path: pytask/taskapp/models.py
# TASK_STATUS_CHOICES = (
#         ("Unpublished", "Unpublished"),
#         ("Open", "Open"),
#         ("Locked", "Locked"),
#         ("Working", "Working"),
#         ("Closed", "Closed"),
#         ("Deleted", "Deleted"),
#         ("Completed", "Completed"))
# TB_STATUS_CHOICES = (
#     ("Unpublished", "Unpublished"),
#     ("Open", "Open"),
#     ("All tasks have users selected", "All tasks have users selected"),
#     ("Completed", "Completed"))
# UPLOADS_DIR = "/pytask/static/uploads"
# class Task(models.Model):
# class TaskComment(models.Model):
# class TaskClaim(models.Model):
# class WorkReport(models.Model):
# class ReportComment(models.Model):
# class PyntRequest(models.Model):
# class TextBook(models.Model):
#     def __unicode__(self):
#     def __unicode__(self):
#     def __unicode__(self):


from datetime import datetime
from django import shortcuts
from django import http
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.context_processors import csrf
from django.core.urlresolvers import reverse
from django.template import RequestContext
from django.utils import simplejson as json
from django.utils.translation import ugettext
from tagging.models import Tag
from tagging.models import TaggedItem
from pytask.helpers import exceptions
from pytask.views import show_msg
from pytask.profile import models as profile_models
from pytask.taskapp import forms as taskapp_forms
from pytask.taskapp import models as taskapp_models

    context.update({
      'user': user,
      'profile': profile,
      'task': task,
      })

    context.update(csrf(request))

    reviewers = task.reviewers.all()
    claimed_users = task.claimed_users.all()

    is_creator = True if user == task.created_by else False
    is_reviewer = True if user in reviewers else False
    has_claimed = True if user in claimed_users else False

    if task.status in [taskapp_models.TASK_STATUS_CHOICES[1][0],
      taskapp_models.TASK_STATUS_CHOICES[3][0]]:
        task_claimable = True
    else:
        task_claimable = False

    if (task_claimable and not has_claimed
      and not is_reviewer and not is_creator):
        can_claim = True
    else:
        can_claim =False

    if (is_creator or is_reviewer or profile.role in
      [profile_models.ROLES_CHOICES[0][0],

# Path: pytask/helpers/exceptions.py
# DEFAULT_ERROR_MESSAGE = ugettext(
#   "There was some error in your request.")
# DEFAULT_LOGIN_MESSAGE = ugettext(
#   "You have to login to view this page.")
# class PyTaskException(Exception):
# class UnauthorizedAccess(PyTaskException):
#     def __init__(self, message=None, **response_args):
#     def __init__(self, message=None, **response_args):
# 
# Path: pytask/views.py
# def show_msg(user, message, redirect_url=None, url_desc=None):
#     """ simply redirect to homepage """
# 
#     context = {
#       'user': user,
#       'message': message,
#       'redirect_url': redirect_url,
#       'url_desc': url_desc
#     }
# 
#     return render_to_response('show_msg.html', context)
# 
# Path: pytask/profile/models.py
# GENDER_CHOICES = (
#   ('Male', 'Male'),
#   ('Female', 'Female'),
# )
# ROLES_CHOICES = (
#   ("Administrator", "Administrator"),
#   ("Coordinator", "Coordinator"),
#   ("Mentor", "Mentor"),
#   ("Contributor", "Contributor"),
# )
# ROLE_CHOICES = (
#   ("Administrator", "Request sent by Administrator \
#     to a user at lower level, asking him to act as a administrator"),
#   ("Coordinator", "Request sent by Coordinator \
#     to a user at lower level, asking him to act as a coordinator"),
# )
# class Profile(models.Model):
# class Notification(models.Model):
# class RoleRequest(models.Model):
#     def __unicode__(self):
# 
# Path: pytask/taskapp/forms.py
# class CreateTaskForm(forms.ModelForm):
#     class Meta:
# class EditTaskForm(forms.ModelForm):
#     class Meta:
# class TaskCommentForm(forms.ModelForm):
#     class Meta:
# class ClaimTaskForm(forms.ModelForm):
#     class Meta:
#     class myform(forms.Form):
# class CreateTextbookForm(forms.ModelForm):
#     class Meta:
# class CreateChapterForm(forms.ModelForm):
#     class Meta:
# class EditTextbookForm(forms.ModelForm):
#     class Meta:
#     class myForm(forms.Form):
#     class myForm(forms.Form):
#     class myForm(forms.Form):
# class WorkReportForm(forms.ModelForm):
#     class Meta:
#     def clean_title(self):
#     def clean_desc(self):
#     def clean_tags_field(self):
#     def clean_desc(self):
#     def clean_title(self):
#     def clean_tags_field(self):
#     def clean_data(self):
#     def clean_proposal(self):
# def ChoiceForm(choices, data=None, label="choice"):
#     def clean_tags_field(self):
#     def clean_tags_field(self):
#     def clean_tags_field(self):
# def AddTaskForm(task_choices, is_plain=False):
# def AssignPyntForm(choices, instance=None):
# def RemoveUserForm(choices, instance=None):
# 
# Path: pytask/taskapp/models.py
# TASK_STATUS_CHOICES = (
#         ("Unpublished", "Unpublished"),
#         ("Open", "Open"),
#         ("Locked", "Locked"),
#         ("Working", "Working"),
#         ("Closed", "Closed"),
#         ("Deleted", "Deleted"),
#         ("Completed", "Completed"))
# TB_STATUS_CHOICES = (
#     ("Unpublished", "Unpublished"),
#     ("Open", "Open"),
#     ("All tasks have users selected", "All tasks have users selected"),
#     ("Completed", "Completed"))
# UPLOADS_DIR = "/pytask/static/uploads"
# class Task(models.Model):
# class TaskComment(models.Model):
# class TaskClaim(models.Model):
# class WorkReport(models.Model):
# class ReportComment(models.Model):
# class PyntRequest(models.Model):
# class TextBook(models.Model):
#     def __unicode__(self):
#     def __unicode__(self):
#     def __unicode__(self):


# Path: pytask/taskapp/views/task.py
from datetime import datetime
from django import shortcuts
from django import http
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.context_processors import csrf
from django.core.urlresolvers import reverse
from django.template import RequestContext
from django.utils import simplejson as json
from django.utils.translation import ugettext
from tagging.models import Tag
from tagging.models import TaggedItem
from pytask.helpers import exceptions
from pytask.views import show_msg
from pytask.profile import models as profile_models
from pytask.taskapp import forms as taskapp_forms
from pytask.taskapp import models as taskapp_models


    context.update({
      'user': user,
      'profile': profile,
      'task': task,
      })

    context.update(csrf(request))

    reviewers = task.reviewers.all()
    claimed_users = task.claimed_users.all()

    is_creator = True if user == task.created_by else False
    is_reviewer = True if user in reviewers else False
    has_claimed = True if user in claimed_users else False

    if task.status in [taskapp_models.TASK_STATUS_CHOICES[1][0],
      taskapp_models.TASK_STATUS_CHOICES[3][0]]:
        task_claimable = True
    else:
        task_claimable = False

    if (task_claimable and not has_claimed
      and not is_reviewer and not is_creator):
        can_claim = True
    else:
        can_claim =False

    if (is_creator or is_reviewer or profile.role in
      [profile_models.ROLES_CHOICES[0][0],

      profile_models.ROLES_CHOICES[1][0]]):