summaryrefslogtreecommitdiff
path: root/tbc
diff options
context:
space:
mode:
authorankitjavalkar2015-01-28 15:24:31 +0530
committerankitjavalkar2015-01-28 15:24:31 +0530
commit23c0c88c1a7c9326f0ade3827ba928e4ae837b46 (patch)
treeeb09736c10d5b83f675abfa263f679e5791354db /tbc
parent8daad37c496a799be5be65e6c95631c202480158 (diff)
downloadPython-TBC-Interface-23c0c88c1a7c9326f0ade3827ba928e4ae837b46.tar.gz
Python-TBC-Interface-23c0c88c1a7c9326f0ade3827ba928e4ae837b46.tar.bz2
Python-TBC-Interface-23c0c88c1a7c9326f0ade3827ba928e4ae837b46.zip
Pending Proposal notification - Add try-except, change count calculation method
Diffstat (limited to 'tbc')
-rwxr-xr-xtbc/templates/base.html12
-rwxr-xr-xtbc/views.py15
2 files changed, 9 insertions, 18 deletions
diff --git a/tbc/templates/base.html b/tbc/templates/base.html
index 62b2da4..f0a572d 100755
--- a/tbc/templates/base.html
+++ b/tbc/templates/base.html
@@ -69,18 +69,6 @@
-moz-border-radius: 9px;
border-radius: 15px;
}
-/* .tooltip-custom {
- max-width: 150px;
- width: auto;
- background-color: #1ABC9C;
- }*/
-
- /* .tooltip-custom .tooltip-inner {
- background-color: #1ABC9C;
- }
- .tooltip-custom .tooltip-arrow {
- border-top-color: #1ABC9C;
- }*/
.tooltip-inner {
background-color: #1ABC9C;
diff --git a/tbc/views.py b/tbc/views.py
index 40d275d..2bfbab5 100755
--- a/tbc/views.py
+++ b/tbc/views.py
@@ -131,13 +131,16 @@ def Home(request):
#Check if user is logged in and fetch user's pending proposal ID
if context.get('user'):
curr_user = request.user
- proposal_pos = 0
-
user_profile = Profile.objects.filter(user=curr_user)
- user_proposal = Proposal.objects.filter(user=user_profile)
- user_proposal_pending = user_proposal.filter(status="pending")
- if user_proposal_pending:
- context['proposal_position'] = user_proposal_pending[0].id
+
+ pending_proposal_list = list(Proposal.objects.filter(status="pending"))
+ try:
+ pending_user_proposal = Proposal.objects.get(user=user_profile, status="pending")
+ except:
+ pending_user_proposal = None
+
+ if pending_user_proposal:
+ context['proposal_position'] = pending_proposal_list.index(pending_user_proposal) + 1
return render_to_response('base.html', context)