# HG changeset patch # User Nishanth Amuluru # Date 1294565490 -19800 # Node ID 9b081296213301c18a1128ce56da567f3b7d1e03 # Parent 070f01dd7d8e88daac93cd716ba7882e0facf163 created the home page diff -r 070f01dd7d8e -r 9b0812962133 pytask/taskapp/views.py --- a/pytask/taskapp/views.py Sun Jan 09 12:01:57 2011 +0530 +++ b/pytask/taskapp/views.py Sun Jan 09 15:01:30 2011 +0530 @@ -245,6 +245,7 @@ task.selected_users.add(selected_user) task.claimed_users.remove(selected_user) + task.status = "WR" task.save() return redirect(task_url) diff -r 070f01dd7d8e -r 9b0812962133 pytask/templates/404.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pytask/templates/404.html Sun Jan 09 15:01:30 2011 +0530 @@ -0,0 +1,5 @@ +{% extends 'base.html' %} +{% block content %} + The page you requested does not exist.
+ Click here to get back to the previous page. +{% endblock %} diff -r 070f01dd7d8e -r 9b0812962133 pytask/templates/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pytask/templates/index.html Sun Jan 09 15:01:30 2011 +0530 @@ -0,0 +1,54 @@ +{% extends 'base.html' %} +{% block content %} + {% if not user %} + Welcome Guest
+ Register + Login

+ {% else %} + Logged in as {{ user.username }}

+ {% endif %} + + {% if can_create_task %} + Add a new textbook
+ Create a task
+
+ {% endif %} + + + {% if unpublished_tasks %} + Unpublished tasks viewable by you: +
+ {% endif %} + + {% if reviewered_tasks %} + Tasks you are reviewering: +
+ {% endif %} + + {% if selected_tasks %} + Tasks that have been assigned to you: +
+ {% endif %} + + {% if claimed_tasks %} + Tasks claimed but still not assigned to you: +
+ {% endif %} + +{% endblock %} diff -r 070f01dd7d8e -r 9b0812962133 pytask/templates/task/select_user.html --- a/pytask/templates/task/select_user.html Sun Jan 09 12:01:57 2011 +0530 +++ b/pytask/templates/task/select_user.html Sun Jan 09 15:01:30 2011 +0530 @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% block content %} - click here to return to the claims page.

+ click here to return to the claims page.

Select a user to assign this task.
{% csrf_token %} diff -r 070f01dd7d8e -r 9b0812962133 pytask/urls.py --- a/pytask/urls.py Sun Jan 09 12:01:57 2011 +0530 +++ b/pytask/urls.py Sun Jan 09 15:01:30 2011 +0530 @@ -5,6 +5,7 @@ import pytask.profile.regbackend from pytask.profile.forms import CustomRegistrationForm +from pytask.views import home_page from django.shortcuts import redirect @@ -33,4 +34,5 @@ (r'^accounts/', include('registration.urls')), (r'^profile/', include('pytask.profile.urls')), (r'^task/', include('pytask.taskapp.urls')), + (r'^$', home_page), ) diff -r 070f01dd7d8e -r 9b0812962133 pytask/views.py --- a/pytask/views.py Sun Jan 09 12:01:57 2011 +0530 +++ b/pytask/views.py Sun Jan 09 15:01:30 2011 +0530 @@ -7,3 +7,29 @@ 'message': message, 'redirect_url': redirect_url, 'url_desc': url_desc}) + +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") + + profile = user.get_profile() + + claimed_tasks = user.claimed_tasks.all() + selected_tasks = user.selected_tasks.all() + reviewing_tasks = user.reviewing_tasks.all() + can_create_task = True if profile.rights != "CT" else False + + context = {"user": user, + "profile": profile, + "claimed_tasks": claimed_tasks, + "selected_tasks": selected_tasks, + "reviewing_tasks": reviewing_tasks, + "can_create_task": can_create_task + } + + return render_to_response("index.html", context)