# 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):


from django.shortcuts import render_to_response
from django.template import RequestContext
from pytask.profile import models as profile_models



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)

def home_page(request):
    """ get the user and display info about the project if not logged in.
    if logged in, display info of their tasks.
    """

    user = request.user
    if not user.is_authenticated():
        return render_to_response("index.html", RequestContext(request, {}))

    profile = user.get_profile()

    claimed_tasks = user.claimed_tasks.all()
    selected_tasks = user.selected_tasks.all()
    reviewing_tasks = user.reviewing_tasks.all()
    unpublished_tasks = user.created_tasks.filter(status="UP").all()

# 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/views.py
from django.shortcuts import render_to_response
from django.template import RequestContext
from pytask.profile import models as profile_models




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)

def home_page(request):
    """ get the user and display info about the project if not logged in.
    if logged in, display info of their tasks.
    """

    user = request.user
    if not user.is_authenticated():
        return render_to_response("index.html", RequestContext(request, {}))

    profile = user.get_profile()

    claimed_tasks = user.claimed_tasks.all()
    selected_tasks = user.selected_tasks.all()
    reviewing_tasks = user.reviewing_tasks.all()
    unpublished_tasks = user.created_tasks.filter(status="UP").all()

    can_create_task = True if profile.role != profile_models.ROLES_CHOICES[3][0] else False