taskapp/views/user.py
author nishanth
Tue, 02 Mar 2010 22:50:17 +0530
changeset 184 8ca20bacc78e
parent 169 229bed827965
child 185 f65e62255e47
permissions -rw-r--r--
created a starthere page.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
61
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
     1
import os
83
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
     2
42
9b5b8c997598 started using django-registration default backend, removed browse users functionality.
anoop
parents: 40
diff changeset
     3
from django.http import HttpResponse, Http404
17
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
     4
from django.shortcuts import redirect, render_to_response
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
     5
from django.contrib.auth.models import User
39
476613c3ab0a Only logged in users can view user profile.
anoop
parents: 28
diff changeset
     6
from django.contrib.auth.decorators import login_required
476613c3ab0a Only logged in users can view user profile.
anoop
parents: 28
diff changeset
     7
83
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
     8
from pytask.taskapp.models import Task, Profile, Request
123
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
     9
83
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
    10
from pytask.taskapp.events.user import createUser, updateProfile
123
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
    11
from pytask.taskapp.events.request import reply_to_request
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
    12
141
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
    13
from pytask.taskapp.forms.user import UserProfileEditForm, UserChoiceForm
123
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
    14
141
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
    15
from pytask.taskapp.utilities.request import get_request, create_request
143
796ff9e279a8 now if a user accepts to be a mentor, all his pending reqs will be made invalid.
nishanth
parents: 141
diff changeset
    16
from pytask.taskapp.utilities.notification import get_notification, create_notification
137
e56b95298254 now requests in sidebar shows the no.of unread notifications.
nishanth
parents: 133
diff changeset
    17
from pytask.taskapp.utilities.user import get_user
17
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    18
127
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    19
about = {
184
8ca20bacc78e created a starthere page.
nishanth
parents: 169
diff changeset
    20
    "addmentors": "about/addmentors.html",
8ca20bacc78e created a starthere page.
nishanth
parents: 169
diff changeset
    21
    "mentor": "about/mentor.html", ## - include role in different stages and merge with mentorrights
8ca20bacc78e created a starthere page.
nishanth
parents: 169
diff changeset
    22
    "starthere": "about/starthere.html",
164
bfe621e64a16 modified the look of browse_requests page task_view page and view_request page.
nishanth
parents: 156
diff changeset
    23
    ## "claimtask":
bfe621e64a16 modified the look of browse_requests page task_view page and view_request page.
nishanth
parents: 156
diff changeset
    24
    ## "edittask": - contains both about up and pub states
bfe621e64a16 modified the look of browse_requests page task_view page and view_request page.
nishanth
parents: 156
diff changeset
    25
    ## "mentorrights":
bfe621e64a16 modified the look of browse_requests page task_view page and view_request page.
nishanth
parents: 156
diff changeset
    26
    ## "assigntask":
bfe621e64a16 modified the look of browse_requests page task_view page and view_request page.
nishanth
parents: 156
diff changeset
    27
    ## "developer":
bfe621e64a16 modified the look of browse_requests page task_view page and view_request page.
nishanth
parents: 156
diff changeset
    28
    ## "manager":
bfe621e64a16 modified the look of browse_requests page task_view page and view_request page.
nishanth
parents: 156
diff changeset
    29
    ## "admin":
bfe621e64a16 modified the look of browse_requests page task_view page and view_request page.
nishanth
parents: 156
diff changeset
    30
    ## "request": - also contains about automatic rejection of requests
127
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    31
}
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    32
108
131554cc3434 updated show_msg method to also use the user variable in the context.
nishanth
parents: 104
diff changeset
    33
def show_msg(user, message, redirect_url=None, url_desc=None):
17
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    34
    """ simply redirect to homepage """
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    35
    
111
c272d4c601cd added the functionality to publish a task.
nishanth
parents: 108
diff changeset
    36
    return render_to_response('show_msg.html',{'user':user, 'message':message, 'redirect_url':redirect_url, 'url_desc':url_desc})
17
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    37
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    38
def homepage(request):
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    39
    """ check for authentication and display accordingly. """
137
e56b95298254 now requests in sidebar shows the no.of unread notifications.
nishanth
parents: 133
diff changeset
    40
   
141
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
    41
    user = request.user
17
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    42
    is_guest = False
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    43
    is_mentor = False
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    44
    can_create_task = False
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    45
    task_list = []
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    46
    
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    47
    if not user.is_authenticated():
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    48
        is_guest = True
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    49
        disp_num = 10
169
229bed827965 fixed a bug in home page for guests.
nishanth
parents: 168
diff changeset
    50
        task_list = Task.objects.exclude(status="UP").exclude(status="CD").exclude(status="CM").order_by('published_datetime').reverse()[:10]
137
e56b95298254 now requests in sidebar shows the no.of unread notifications.
nishanth
parents: 133
diff changeset
    51
        return render_to_response('index.html', {'user':user, 'is_guest':is_guest, 'task_list':task_list})
21
c28774fe7ffd implemented "add another mentor" functionality to a task.
nishanth
parents: 20
diff changeset
    52
        
17
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    53
    else:
141
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
    54
        user = get_user(request.user)
17
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    55
        user_profile = user.get_profile()
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    56
        is_mentor = True if user.task_mentors.all() else False
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    57
        can_create_task = False if user_profile.rights == u"CT" else True
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    58
        
21
c28774fe7ffd implemented "add another mentor" functionality to a task.
nishanth
parents: 20
diff changeset
    59
        context = {'user':user,
c28774fe7ffd implemented "add another mentor" functionality to a task.
nishanth
parents: 20
diff changeset
    60
                   'is_guest':is_guest,
c28774fe7ffd implemented "add another mentor" functionality to a task.
nishanth
parents: 20
diff changeset
    61
                   'is_mentor':is_mentor,
c28774fe7ffd implemented "add another mentor" functionality to a task.
nishanth
parents: 20
diff changeset
    62
                   'task_list':task_list,
c28774fe7ffd implemented "add another mentor" functionality to a task.
nishanth
parents: 20
diff changeset
    63
                   'can_create_task':can_create_task,
c28774fe7ffd implemented "add another mentor" functionality to a task.
nishanth
parents: 20
diff changeset
    64
                   }
125
d3cfceb8e120 homepage now displays a list of unpublished tasks
nishanth
parents: 123
diff changeset
    65
d3cfceb8e120 homepage now displays a list of unpublished tasks
nishanth
parents: 123
diff changeset
    66
        context["unpublished_tasks"] = user.task_mentors.filter(status="UP")
168
42aba20cfe97 made the home page look clean.
nishanth
parents: 167
diff changeset
    67
        context["mentored_tasks"] = user.task_mentors.exclude(status="UP").exclude(status="CM").exclude(status="CD").exclude(status="DL")
42aba20cfe97 made the home page look clean.
nishanth
parents: 167
diff changeset
    68
        context["claimed_tasks"] = user.task_claimed_users.exclude(status="UP").exclude(status="CM").exclude(status="CD").exclude(status="DL")
42aba20cfe97 made the home page look clean.
nishanth
parents: 167
diff changeset
    69
        context["working_tasks"] = user.task_assigned_users.filter(status="WR")
21
c28774fe7ffd implemented "add another mentor" functionality to a task.
nishanth
parents: 20
diff changeset
    70
                   
c28774fe7ffd implemented "add another mentor" functionality to a task.
nishanth
parents: 20
diff changeset
    71
        return render_to_response('index.html', context)
17
aa45fec40e7e renamed users.py to user.py and tasks to task in views folder and updated urls.py accordingly .
nishanth
parents:
diff changeset
    72
39
476613c3ab0a Only logged in users can view user profile.
anoop
parents: 28
diff changeset
    73
@login_required
127
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    74
def learn_more(request, what):
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    75
    """ depending on what was asked for, we render different pages.
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    76
    """
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    77
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
    78
    user = get_user(request.user)
127
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    79
    disp_template = about.get(what, None)
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    80
    if not disp_template:
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    81
        raise Http404
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    82
    else:
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
    83
        return render_to_response(disp_template, {'user':user})
127
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    84
71888e23f323 created a view for about pages and added about pages for mentor and addmentors.
nishanth
parents: 125
diff changeset
    85
@login_required
42
9b5b8c997598 started using django-registration default backend, removed browse users functionality.
anoop
parents: 40
diff changeset
    86
def view_my_profile(request,uid=None):
23
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
    87
    """ allows the user to view the profiles of users """
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
    88
    user = get_user(request.user)
42
9b5b8c997598 started using django-registration default backend, removed browse users functionality.
anoop
parents: 40
diff changeset
    89
    if uid == None:
9b5b8c997598 started using django-registration default backend, removed browse users functionality.
anoop
parents: 40
diff changeset
    90
        edit_profile = True
9b5b8c997598 started using django-registration default backend, removed browse users functionality.
anoop
parents: 40
diff changeset
    91
        profile = Profile.objects.get(user = request.user)
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
    92
        return render_to_response('user/my_profile.html', {'edit_profile':edit_profile,'profile':profile, 'user':user})
23
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
    93
    edit_profile = True if request.user == User.objects.get(pk=uid) else False
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
    94
    try:
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
    95
        profile = Profile.objects.get(user = User.objects.get(pk=uid))
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
    96
    except Profile.DoesNotExist:
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
    97
        raise Http404
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
    98
    return render_to_response('user/my_profile.html', {'edit_profile':edit_profile,'profile':profile, 'user':user})
23
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
    99
45
ab8918e654ae added forgot password in template.
anoop
parents: 42
diff changeset
   100
@login_required
23
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   101
def edit_my_profile(request):
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   102
    """ enables the user to edit his/her user profile """
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
   103
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
   104
    user = get_user(request.user)
23
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   105
    if request.method == 'POST':
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   106
        form = UserProfileEditForm(request.POST)
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   107
#        if not form.is_valid():
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   108
#            edit_profile_form = UserProfileEditForm(instance = form)
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   109
#            return render_to_response('user/edit_profile.html',{'edit_profile_form' : edit_profile_form})
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   110
        if request.user.is_authenticated() == True:
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   111
            profile = Profile.objects.get(user = request.user)
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   112
            data = request.POST#form.cleaned_data
61
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   113
            properties = {'aboutme':data['aboutme'],
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   114
                          'foss_comm':data['foss_comm'],
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   115
                          'phonenum':data['phonenum'],
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   116
                          'homepage':data['homepage'],
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   117
                          'street':data['street'],
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   118
                          'city':data['city'],
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   119
                          'country':data['country'],
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   120
                          'nick':data['nick']}
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   121
            uploaded_photo = request.FILES.get('photo',None)
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   122
            prev_photo = profile.photo
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   123
            if uploaded_photo:
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   124
                if prev_photo:
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   125
                    os.remove(prev_photo.path)
708dd49d531b added custom image storage for profile photo.
nishanth
parents: 60
diff changeset
   126
                properties['photo'] = uploaded_photo
23
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   127
            #fields = ['dob','gender','credits','aboutme','foss_comm','phonenum','homepage','street','city','country','nick']
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   128
            updateProfile(profile,properties)
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   129
            return redirect('/user/view/uid='+str(profile.user_id))
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   130
    else:
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   131
        profile = Profile.objects.get(user = request.user)
f33084ea1361 added view profile and edit profile functionalities.
anoop
parents: 21
diff changeset
   132
        edit_profile_form = UserProfileEditForm(instance = profile)
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
   133
        return render_to_response('user/edit_profile.html',{'edit_profile_form' : edit_profile_form, 'user':user})
28
e137b605b888 added browse users functionality, added user/browse.html, fixed view my profile template.
anoop
parents: 27
diff changeset
   134
83
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   135
@login_required
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   136
def browse_requests(request):
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   137
    
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
   138
    user = get_user(request.user)
122
daee11bdfbaa now rid is not the position argument. it is request id.
nishanth
parents: 111
diff changeset
   139
    active_reqs = user.request_sent_to.filter(is_replied=False).exclude(is_valid=False)
83
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   140
    reqs = active_reqs.order_by('creation_date').reverse()
122
daee11bdfbaa now rid is not the position argument. it is request id.
nishanth
parents: 111
diff changeset
   141
83
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   142
    context = {
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   143
        'user':user,
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   144
        'reqs':reqs,
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   145
    }
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   146
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   147
    return render_to_response('user/browse_requests.html', context)
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   148
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   149
@login_required
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   150
def view_request(request, rid):
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   151
    """ please note that request variable in this method is that of django.
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   152
    our app request is called user_request.
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   153
    """
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   154
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
   155
    user = get_user(request.user)
143
796ff9e279a8 now if a user accepts to be a mentor, all his pending reqs will be made invalid.
nishanth
parents: 141
diff changeset
   156
    user_rights = user.get_profile().rights
133
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   157
    newest, newer, user_request, older, oldest = get_request(rid, user)
122
daee11bdfbaa now rid is not the position argument. it is request id.
nishanth
parents: 111
diff changeset
   158
    if not user_request:
daee11bdfbaa now rid is not the position argument. it is request id.
nishanth
parents: 111
diff changeset
   159
        raise Http404
daee11bdfbaa now rid is not the position argument. it is request id.
nishanth
parents: 111
diff changeset
   160
100
2275886511df now admin can accept a request for assigning credits.
nishanth
parents: 97
diff changeset
   161
    user_request.is_read = True
2275886511df now admin can accept a request for assigning credits.
nishanth
parents: 97
diff changeset
   162
    user_request.save()
83
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   163
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   164
    context = {
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   165
        'user':user,
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   166
        'req':user_request,
133
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   167
        'sent_users':user_request.sent_to.all(),
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   168
        'newest':newest,
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   169
        'newer':newer,
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   170
        'older':older,
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   171
        'oldest':oldest,
83
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   172
    }
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   173
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   174
    return render_to_response('user/view_request.html', context)
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   175
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   176
@login_required
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   177
def process_request(request, rid, reply):
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   178
    """ check if the method is post and then update the request.
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   179
    if it is get, display a 404 error.
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   180
    """
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   181
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
   182
    user = get_user(request.user)
122
daee11bdfbaa now rid is not the position argument. it is request id.
nishanth
parents: 111
diff changeset
   183
    browse_request_url= '/user/requests'
133
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   184
    newest, newer, req_obj, older, oldest = get_request(rid, user)
122
daee11bdfbaa now rid is not the position argument. it is request id.
nishanth
parents: 111
diff changeset
   185
daee11bdfbaa now rid is not the position argument. it is request id.
nishanth
parents: 111
diff changeset
   186
    if not req_obj:
daee11bdfbaa now rid is not the position argument. it is request id.
nishanth
parents: 111
diff changeset
   187
        return show_msg(user, "Your reply has been processed", browse_request_url, "view other requests")
100
2275886511df now admin can accept a request for assigning credits.
nishanth
parents: 97
diff changeset
   188
83
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   189
    if request.method=="POST":
100
2275886511df now admin can accept a request for assigning credits.
nishanth
parents: 97
diff changeset
   190
        reply = True if reply == "yes" else False
104
d1bdd5d6c1a6 added the field remarks in request model.
nishanth
parents: 103
diff changeset
   191
        req_obj.remarks = request.POST.get('remarks', "")
d1bdd5d6c1a6 added the field remarks in request model.
nishanth
parents: 103
diff changeset
   192
        req_obj.save()
d1bdd5d6c1a6 added the field remarks in request model.
nishanth
parents: 103
diff changeset
   193
100
2275886511df now admin can accept a request for assigning credits.
nishanth
parents: 97
diff changeset
   194
        reply_to_request(req_obj, reply, user)
133
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   195
152
a65e1ef725dd after replying to a request, you are redirected to browse redirects page.
nishanth
parents: 148
diff changeset
   196
        return redirect('/user/requests/')
108
131554cc3434 updated show_msg method to also use the user variable in the context.
nishanth
parents: 104
diff changeset
   197
        return show_msg(user, "Your reply has been processed", browse_request_url, "view other requests")
83
fd2e1bd7af82 added accept_assign_credits request
nishanth
parents: 69
diff changeset
   198
    else:
108
131554cc3434 updated show_msg method to also use the user variable in the context.
nishanth
parents: 104
diff changeset
   199
        return show_msg(user, "You are not authorised to do this", browse_request_url, "view other requests")
101
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   200
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   201
@login_required
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   202
def browse_notifications(request):
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   203
    """ get the list of notifications that are not deleted and display in datetime order.
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   204
    """
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   205
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
   206
    user = get_user(request.user)
101
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   207
123
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
   208
    active_notifications = user.notification_sent_to.filter(is_deleted=False).order_by('sent_date').reverse()
101
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   209
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   210
    context = {
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   211
        'user':user,
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   212
        'notifications':active_notifications,
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   213
    }
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   214
e2903a92b5e8 added browse_notifications functionality .
nishanth
parents: 100
diff changeset
   215
    return render_to_response('user/browse_notifications.html', context)
103
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   216
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   217
@login_required
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   218
def view_notification(request, nid):
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   219
    """ get the notification depending on nid.
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   220
    Display it.
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   221
    """
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   222
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
   223
    user = get_user(request.user)
133
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   224
    newest, newer, notification, older, oldest = get_notification(nid, user)
123
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
   225
    if not notification:
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
   226
        raise Http404
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
   227
103
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   228
    notification.is_read = True
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   229
    notification.save()
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   230
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   231
    context = {
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   232
        'user':user,
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   233
        'notification':notification,
133
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   234
        'newest':newest,
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   235
        'newer':newer,
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   236
        'older':older,
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   237
        'oldest':oldest,
103
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   238
    }
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   239
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   240
    return render_to_response('user/view_notification.html', context)
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   241
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   242
@login_required
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   243
def edit_notification(request, nid, action):
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   244
    """ if action is delete, set is_deleted.
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   245
    if it is unread, unset is_read.
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   246
    save the notification and redirect to browse_notifications.
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   247
    """
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   248
138
c452c699a8af now all the pages show number of unread beside requests and notifications link in sidebar.
nishanth
parents: 137
diff changeset
   249
    user = get_user(request.user)
133
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   250
    newest, newer, notification, older, oldest = get_notification(nid, user)
123
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
   251
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
   252
    if not notification:
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
   253
        raise Http404
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
   254
103
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   255
    notifications_url = "/user/notifications/"
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   256
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   257
    if request.method == "POST":
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   258
        if action == "delete":
123
a6b4234388c8 now notification depends on id and not pos.
nishanth
parents: 122
diff changeset
   259
            notification.is_deleted = True
103
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   260
        elif action == "unread":
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   261
            notification.is_read = False
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   262
        
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   263
        notification.save()
133
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   264
        if older:
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   265
            return redirect('/user/notifications/nid=%s'%older.id)
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   266
        else:
34187a80d279 added next and previous capabilities to requests and notifications.
nishanth
parents: 127
diff changeset
   267
            return redirect(notifications_url)
103
3a4c8fccb9f3 added the functionality to view each notification
nishanth
parents: 101
diff changeset
   268
    else:
108
131554cc3434 updated show_msg method to also use the user variable in the context.
nishanth
parents: 104
diff changeset
   269
        return show_msg(user, 'This is wrong', notification_url, "view the notification")
141
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   270
 
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   271
@login_required
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   272
def change_rights(request, role):
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   273
    """ check if the current user has privileges to do this.
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   274
    """
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   275
    
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   276
    user = get_user(request.user)
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   277
    role = role.upper()
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   278
    user_profile = user.get_profile()
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   279
    user_rights = user_profile.rights
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   280
145
0c97a02b9bdb now accepting to be a MG deleted pending DV and MG reqs.
nishanth
parents: 143
diff changeset
   281
    user_can_view = True if user_rights == "AD" or ( user_rights == "MG" and role in ["MG", "DV"] ) else False
141
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   282
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   283
    if user_can_view:
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   284
        if role == "DV":
148
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   285
            current_contributors = list(User.objects.filter(is_active=True,profile__rights="CT"))
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   286
            pending_requests = user.request_sent_by.filter(is_replied=False,is_valid=True)
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   287
            pending_dv_requests = pending_requests.filter(role="DV")
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   288
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   289
            ## one cannot make same request many times
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   290
            for req in pending_dv_requests:
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   291
                current_contributors.remove(req.sent_to.all()[0])
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   292
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   293
            choices = [ (_.id,_.username ) for _ in current_contributors ]
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   294
141
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   295
        elif role == "MG":
148
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   296
            active_users = User.objects.filter(is_active=True)
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   297
            dv_ct_users = list(active_users.filter(profile__rights="CT") | active_users.filter(profile__rights="DV"))
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   298
            pending_requests = user.request_sent_by.filter(is_replied=False,is_valid=True)
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   299
            pending_mg_requests = pending_requests.filter(role="MG")
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   300
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   301
            ## same logic here. you cannot make another request exactly the same.
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   302
            ## but iam still not decided whether someone who requests a user to be admin,
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   303
            ## can be given a chance to request the same user to be a manager or developer
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   304
            for req in pending_mg_requests:
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   305
                dv_ct_users.remove(req.sent_to.all()[0])
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   306
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   307
            choices = [ (_.id, _.username ) for _ in dv_ct_users ]
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   308
141
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   309
        elif role == "AD":
148
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   310
            active_users = User.objects.filter(is_active=True)
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   311
            non_ad_users = list(active_users.exclude(profile__rights="AD"))
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   312
            pending_requests = user.request_sent_by.filter(is_replied=False,is_valid=True)
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   313
            pending_ad_requests = pending_requests.filter(role="AD")
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   314
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   315
            ## we filter out users who have already been requested by the user to be an admin
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   316
            for req in pending_ad_requests:
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   317
                non_ad_users.remove(req.sent_to.all()[0])
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   318
665eaf56e1d0 now a user who was requested to be something cannot be requested to be the same again.
nishanth
parents: 145
diff changeset
   319
            choices = [ (_.id,_.username ) for _ in non_ad_users ]
141
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   320
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   321
        form = UserChoiceForm(choices)
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   322
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   323
        context = {
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   324
            'user':user,
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   325
            'form':form,
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   326
        }
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   327
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   328
        if request.method=="POST":
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   329
            data = request.POST
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   330
            form = UserChoiceForm(choices, data)
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   331
            if form.is_valid():
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   332
                user_to_change = User.objects.get(id=form.cleaned_data['user'])
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   333
                create_request(sent_by=user, role=role, sent_to=user_to_change)
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   334
                return show_msg(user, "A request has been sent", "/", "return to home page")
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   335
            else:
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   336
                raise Http404
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   337
        else:
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   338
            return render_to_response('user/changerole.html', context)
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   339
    else:
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   340
        raise Http404
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   341
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   342
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   343
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   344
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   345
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   346
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   347
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   348
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   349
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   350
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   351
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   352
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   353
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   354
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   355
2489392ffb56 added the functionality to request a user to be AD MG DV.
nishanth
parents: 138
diff changeset
   356