author | Madhusudan.C.S <madhusudancs@gmail.com> |
Mon, 17 Jan 2011 05:33:27 +0530 | |
changeset 442 | 7e6da295b90a |
parent 369 | 602a909e9e16 |
child 447 | b7faad734d6f |
permissions | -rw-r--r-- |
338 | 1 |
from django.shortcuts import render_to_response |
2 |
||
442
7e6da295b90a
Use the right name for the profile role's values.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
369
diff
changeset
|
3 |
from pytask.profile import models as profile_models |
7e6da295b90a
Use the right name for the profile role's values.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
369
diff
changeset
|
4 |
|
7e6da295b90a
Use the right name for the profile role's values.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
369
diff
changeset
|
5 |
|
338 | 6 |
def show_msg(user, message, redirect_url=None, url_desc=None): |
7 |
""" simply redirect to homepage """ |
|
8 |
||
9 |
return render_to_response('show_msg.html',{'user': user, |
|
10 |
'message': message, |
|
11 |
'redirect_url': redirect_url, |
|
12 |
'url_desc': url_desc}) |
|
363
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
13 |
|
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
14 |
def home_page(request): |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
15 |
""" get the user and display info about the project if not logged in. |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
16 |
if logged in, display info of their tasks. |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
17 |
""" |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
18 |
|
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
19 |
user = request.user |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
20 |
if not user.is_authenticated(): |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
21 |
return render_to_response("index.html") |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
22 |
|
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
23 |
profile = user.get_profile() |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
24 |
|
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
25 |
claimed_tasks = user.claimed_tasks.all() |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
26 |
selected_tasks = user.selected_tasks.all() |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
27 |
reviewing_tasks = user.reviewing_tasks.all() |
367
13e171f09941
added unpublished tasks to home_page
Nishanth Amuluru <nishanth@fossee.in>
parents:
363
diff
changeset
|
28 |
unpublished_tasks = user.created_tasks.filter(status="UP").all() |
442
7e6da295b90a
Use the right name for the profile role's values.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
369
diff
changeset
|
29 |
can_create_task = True if profile.role != profile_models.ROLES_CHOICES[3][0] else False |
363
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
30 |
|
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
31 |
context = {"user": user, |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
32 |
"profile": profile, |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
33 |
"claimed_tasks": claimed_tasks, |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
34 |
"selected_tasks": selected_tasks, |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
35 |
"reviewing_tasks": reviewing_tasks, |
367
13e171f09941
added unpublished tasks to home_page
Nishanth Amuluru <nishanth@fossee.in>
parents:
363
diff
changeset
|
36 |
"unpublished_tasks": unpublished_tasks, |
363
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
37 |
"can_create_task": can_create_task |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
38 |
} |
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
39 |
|
9b0812962133
created the home page
Nishanth Amuluru <nishanth@fossee.in>
parents:
338
diff
changeset
|
40 |
return render_to_response("index.html", context) |
369
602a909e9e16
added under_construction view and used it
Nishanth Amuluru <nishanth@fossee.in>
parents:
367
diff
changeset
|
41 |
|
602a909e9e16
added under_construction view and used it
Nishanth Amuluru <nishanth@fossee.in>
parents:
367
diff
changeset
|
42 |
def under_construction(request): |
602a909e9e16
added under_construction view and used it
Nishanth Amuluru <nishanth@fossee.in>
parents:
367
diff
changeset
|
43 |
|
602a909e9e16
added under_construction view and used it
Nishanth Amuluru <nishanth@fossee.in>
parents:
367
diff
changeset
|
44 |
return render_to_response("under_construction.html") |