summaryrefslogtreecommitdiff
path: root/papillon
diff options
context:
space:
mode:
Diffstat (limited to 'papillon')
-rw-r--r--papillon/locale/fr/LC_MESSAGES/django.po14
-rw-r--r--papillon/polls/models.py4
-rw-r--r--papillon/polls/views.py3
-rw-r--r--papillon/settings.py.tpl1
-rw-r--r--papillon/templates/vote.html6
5 files changed, 18 insertions, 10 deletions
diff --git a/papillon/locale/fr/LC_MESSAGES/django.po b/papillon/locale/fr/LC_MESSAGES/django.po
index 4d09e84..af612c7 100644
--- a/papillon/locale/fr/LC_MESSAGES/django.po
+++ b/papillon/locale/fr/LC_MESSAGES/django.po
@@ -1,5 +1,5 @@
# Papillon
-# Copyright (C) 2008
+# Copyright (C) 2008-2011
# This file is distributed under the same license as the papillon package.
# Étienne Loks <etienne.loks@peacefrogs.net>, 2008.
#
@@ -8,10 +8,11 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-12-04 23:49+0100\n"
+"POT-Creation-Date: 2011-10-25 00:49+0200\n"
"PO-Revision-Date: 2008-08-20 00:22+0200\n"
"Last-Translator: Étienne Loks <etienne.loks@peacefrogs.net>,\n"
"Language-Team: fr\n"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -282,8 +283,7 @@ msgstr "Retourner au sondage"
msgid "Choices"
msgstr "Choix"
-#: templates/editChoicesUser.html:21 templates/vote.html:23
-#: templates/vote.html.py:144
+#: templates/editChoicesUser.html:21 templates/vote.html:144
msgid "DATETIME_FORMAT"
msgstr ""
@@ -358,6 +358,11 @@ msgstr "syndication"
msgid "Comments"
msgstr "Commentaires"
+#: templates/vote.html:128
+#, python-format
+msgid "%(max_comment_nb)s max"
+msgstr "%(max_comment_nb)s maximum"
+
#: templates/vote.html:137
msgid "Comment"
msgstr "Commentaire"
@@ -381,4 +386,3 @@ msgid ": %(sum)s vote"
msgid_plural ": %(sum)s votes"
msgstr[0] " : %(sum)s vote"
msgstr[1] " : %(sum)s votes"
-
diff --git a/papillon/polls/models.py b/papillon/polls/models.py
index f8b3b22..411e75f 100644
--- a/papillon/polls/models.py
+++ b/papillon/polls/models.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2008 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2008-2011 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
@@ -138,7 +138,7 @@ the poll/check this option to reopen it"))
class Comment(models.Model):
'''Comment for a poll'''
- poll = models.ForeignKey(Poll)
+ poll = models.ForeignKey(Poll, related_name='comments')
author_name = models.CharField(max_length=100)
text = models.CharField(max_length=1000)
date = models.DateTimeField(auto_now_add=True)
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)
diff --git a/papillon/settings.py.tpl b/papillon/settings.py.tpl
index 7ca2761..b40a37e 100644
--- a/papillon/settings.py.tpl
+++ b/papillon/settings.py.tpl
@@ -14,6 +14,7 @@ EXTRA_URL = 'papillon/'
BASE_SITE = SERVER_URL + EXTRA_URL
TINYMCE_URL = 'http://localhost/tinymce/'
+MAX_COMMENT_NB = 10 # max number of comments by poll - 0 to disable comments
# time to live in days
DAYS_TO_LIVE = 30
diff --git a/papillon/templates/vote.html b/papillon/templates/vote.html
index dc384f5..5c20e5c 100644
--- a/papillon/templates/vote.html
+++ b/papillon/templates/vote.html
@@ -124,10 +124,10 @@
{%if hide_vote%}<p>{% trans "You have already vote? You are enough wise not to be influenced by other votes? You can display result by clicking" %} <a href='?display_result=1'>{% trans "here" %}</a>.</p>{%else%}
<p>{% trans "Remain informed of poll evolution:" %} <a href="../../feeds/poll/{{poll.base_url}}">{%trans "syndication"%}</a></p>{%endif%}
</div>
-{%if not hide_vote%}
-<h3>{%trans "Comments"%}</h3>
+{%if not hide_vote and max_comment_nb %}
+<h3>{%trans "Comments"%} ({% blocktrans %}{{max_comment_nb}} max{% endblocktrans %})</h3>
<div class='comments'>
- {%if poll.open%}<form method='post' action='.'>
+ {%if poll.open and max_comment_nb > poll.comments.count %}<form method='post' action='.'>
<table class='comment'>
<tr>
<td><label for='comment_author'>{% trans "Author name" %}</label></td>