diff options
Diffstat (limited to 'tbc')
-rwxr-xr-x | tbc/views.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tbc/views.py b/tbc/views.py index 2c8dac9..6b3e31a 100755 --- a/tbc/views.py +++ b/tbc/views.py @@ -48,7 +48,7 @@ def email_send(to,subject,msg): def is_reviewer(user): - if user.groups.filter(name='reviewer').count() == 1: + if user.groups.filter(name='reviewer').exists(): return True @@ -127,6 +127,20 @@ def Home(request): obj = {'book':books[i], 'image':images[i]} book_images.append(obj) context['items'] = book_images + + #Check if user is logged in, Fetch user's pending proposal ID + if context.get('user'): + curr_user = request.user + proposal_pos = 0 + + user_profile = Profile.objects.get(user=curr_user.id) + pending_proposal = list(Proposal.objects.filter(status="pending")) + user_proposal = Proposal.objects.filter(user=user_profile) + user_proposal_pending = user_proposal.filter(status="pending")[0] + if user_proposal_pending in pending_proposal: + proposal_position = user_proposal_pending.id + context['proposal_position'] = proposal_position + return render_to_response('base.html', context) @@ -1266,7 +1280,6 @@ def RedirectToIpynb(request, notebook_path=None): # ajax views @csrf_exempt def ajax_matching_books(request): - print "here" titles = request.POST["titles"] titles = json.loads(titles) matches = [] |