diff options
author | Hardik Ghaghada | 2015-01-28 17:01:14 +0530 |
---|---|---|
committer | Hardik Ghaghada | 2015-01-28 17:01:14 +0530 |
commit | 00a7dbb6b01e40840dcd982dc37a43359c45d6f0 (patch) | |
tree | c337e61114a44db6f7aef4bb08442ee1a6882668 /tbc | |
parent | 1cf6d1735a9e64ea5821ce05f8c331f487cb24b6 (diff) | |
parent | 23c0c88c1a7c9326f0ade3827ba928e4ae837b46 (diff) | |
download | Python-TBC-Interface-00a7dbb6b01e40840dcd982dc37a43359c45d6f0.tar.gz Python-TBC-Interface-00a7dbb6b01e40840dcd982dc37a43359c45d6f0.tar.bz2 Python-TBC-Interface-00a7dbb6b01e40840dcd982dc37a43359c45d6f0.zip |
Merge pull request #12 from ankitjavalkar/pending-count-minor
Pending Proposal notification - Add try-except, change count calculation
Diffstat (limited to 'tbc')
-rwxr-xr-x | tbc/templates/base.html | 12 | ||||
-rwxr-xr-x | tbc/views.py | 15 |
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 524e0d1..d93a410 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) |