summaryrefslogtreecommitdiff
path: root/papillon/polls/views.py
diff options
context:
space:
mode:
authorÉtienne Loks2011-10-25 00:53:14 +0200
committerÉtienne Loks2011-10-25 00:53:14 +0200
commit229e7616b16ee1f316b9a9ab5442631ff5033668 (patch)
tree11fea83203b9c90278e20d4fff45996c73923ce8 /papillon/polls/views.py
parente41e52768085a81b1b5d48f5f0583b6449179fa8 (diff)
Limit comments by poll (closes #310)
Diffstat (limited to 'papillon/polls/views.py')
-rw-r--r--papillon/polls/views.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/papillon/polls/views.py b/papillon/polls/views.py
index 75823be..1022f58 100644
--- a/papillon/polls/views.py
+++ b/papillon/polls/views.py
@@ -333,6 +333,8 @@ def poll(request, poll_url):
v.save()
def newComment(request, poll):
"Comment the poll"
+ if poll.comments.count() >= settings.MAX_COMMENT_NB:
+ return
if 'comment_author' not in request.POST \
or not request.POST['comment_author'] \
or not request.POST['comment']:
@@ -486,4 +488,5 @@ def poll(request, poll_url):
if 'knowned_vote_' + poll.base_url in request.session:
response_dct['hide_vote'] = False
response_dct['form_comment'] = CommentForm()
+ response_dct['max_comment_nb'] = settings.MAX_COMMENT_NB
return render_to_response('vote.html', response_dct)