summaryrefslogtreecommitdiffstats
path: root/askbot/views
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-04-11 04:41:53 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2013-04-11 04:41:53 -0400
commit0e2b9b7225d71e6a1b8d9c929570daf5ef44c012 (patch)
tree4214bf6991ea1b08d5689b739700e0f6216981ed /askbot/views
parent6b5ad87abfcc97653b57974a4f75c27bc2b18cc6 (diff)
downloadaskbot-0e2b9b7225d71e6a1b8d9c929570daf5ef44c012.tar.gz
askbot-0e2b9b7225d71e6a1b8d9c929570daf5ef44c012.tar.bz2
askbot-0e2b9b7225d71e6a1b8d9c929570daf5ef44c012.zip
refactored the voting function a little
Diffstat (limited to 'askbot/views')
-rw-r--r--askbot/views/commands.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/askbot/views/commands.py b/askbot/views/commands.py
index b7642440..1436d3c8 100644
--- a/askbot/views/commands.py
+++ b/askbot/views/commands.py
@@ -203,7 +203,7 @@ def process_vote(user = None, vote_direction = None, post = None):
@csrf.csrf_exempt
-def vote(request, id):
+def vote(request):
"""
todo: this subroutine needs serious refactoring it's too long and is hard to understand
@@ -262,6 +262,8 @@ def vote(request, id):
else:
raise Exception(_('Sorry, something is not right here...'))
+ id = request.POST.get('postId')
+
if vote_type == '0':
if askbot_settings.ACCEPTING_ANSWERS_ENABLED is False:
return
@@ -296,8 +298,8 @@ def vote(request, id):
if vote_type in ('5', '6'):
#todo: fix this weirdness - why postId here
#and not with question?
- id = request.POST.get('postId')
- post = get_object_or_404(models.Post, post_type='answer', id=id)
+ post_id = request.POST.get('postId')
+ post = get_object_or_404(models.Post, post_type='answer', id=post_id)
else:
post = get_object_or_404(models.Post, post_type='question', id=id)
#