summaryrefslogtreecommitdiff
path: root/tbc/views.py
diff options
context:
space:
mode:
authorankitjavalkar2015-01-20 15:15:29 +0530
committerankitjavalkar2015-01-20 15:15:29 +0530
commitbfbad9e4cdf5a99c0ade226a3f88592c55cc6ea1 (patch)
tree2e212825f9d92a03a04d36e0895413765f1deb93 /tbc/views.py
parent994154767f692655529c9b13f86b02bbcb7ec5b6 (diff)
downloadPython-TBC-Interface-bfbad9e4cdf5a99c0ade226a3f88592c55cc6ea1.tar.gz
Python-TBC-Interface-bfbad9e4cdf5a99c0ade226a3f88592c55cc6ea1.tar.bz2
Python-TBC-Interface-bfbad9e4cdf5a99c0ade226a3f88592c55cc6ea1.zip
Add Feature - Pending Proposal notification badge - views.py
add proposal fetching logic in views.py
Diffstat (limited to 'tbc/views.py')
-rwxr-xr-xtbc/views.py17
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 = []