summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--polls/models.py4
-rw-r--r--polls/views.py8
-rw-r--r--static/styles.css5
-rw-r--r--templates/base.html2
-rw-r--r--templates/createOrEdit.html2
-rw-r--r--urls.py2
6 files changed, 16 insertions, 7 deletions
diff --git a/polls/models.py b/polls/models.py
index cbecbd9..d76acaa 100644
--- a/polls/models.py
+++ b/polls/models.py
@@ -65,7 +65,7 @@ class Choice(models.Model):
poll = models.ForeignKey(Poll)
name = models.CharField(max_length=200)
order = models.IntegerField()
- limit = models.IntegerField(null=True)
+ limit = models.IntegerField(null=True, blank=True)
available = models.BooleanField(default=True)
class Admin:
pass
@@ -78,4 +78,4 @@ class Vote(models.Model):
VOTE = ((1, (_('Yes'), _('Yes'))),
(0, (_('No'), _('Maybe')), ),
(-1, (_('No'), _('No'))),)
- value = models.IntegerField(choices=VOTE, null=True)
+ value = models.IntegerField(choices=VOTE, blank=True)
diff --git a/polls/views.py b/polls/views.py
index e768e2b..11cad2e 100644
--- a/polls/views.py
+++ b/polls/views.py
@@ -46,7 +46,7 @@ def getBaseResponse(request):
return None, HttpResponseRedirect(request.path)
languages = []
for language_code, language_label in LANGUAGES:
- languages.append((language_code, _(language_label)))
+ languages.append((language_code, language_label))
return {'root_url':url, 'languages':languages}, None
def index(request):
@@ -163,12 +163,16 @@ admin_url=admin_url, status = 'D', type=request.POST['poll_type'])
choice = Choice(poll=poll, name=request.POST['new_choice'],
order=order, limit=limit)
choice.save()
- # check if a choice has been choosen for deletion
+ # check if a choice has been choosen for deletion or for modification
for key in request.POST:
if key.startswith('delete_') and request.POST[key]:
choice = Choice.objects.get(id=int(key[len('delete_'):]))
Vote.objects.filter(choice=choice).delete()
choice.delete()
+ if key.startswith('modify_') and request.POST[key]:
+ choice = Choice.objects.get(id=int(key[len('modify_'):]))
+ choice.name = request.POST[key]
+ choice.save()
return response_dct, None
response_dct, redirect = getBaseResponse(request)
diff --git a/static/styles.css b/static/styles.css
index 5cecfef..e41d670 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -20,6 +20,7 @@ See the file COPYING for details.
body{
margin:0;
font-size:12px;
+font-family:arial;
background-color:#ced3e1;
}
@@ -44,6 +45,10 @@ margin:10px;
font-size:24px;
}
+h2 a:hover{
+color:grey;
+}
+
p{
padding:6px;
margin:6px;
diff --git a/templates/base.html b/templates/base.html
index 768bc74..3a0b3b7 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" href="/papillon/static/styles.css" />
- <title>{% block title %}Polls{% endblock %}</title>
+ <title>{% block title %}Papillon{% endblock %}</title>
</head>
<body>
diff --git a/templates/createOrEdit.html b/templates/createOrEdit.html
index e76decd..4cc7420 100644
--- a/templates/createOrEdit.html
+++ b/templates/createOrEdit.html
@@ -52,7 +52,7 @@
<th>{% trans "Choices" %}</th><th>{% trans "Label" %}</th><th>{% trans "Limit" %}</th><th>{% trans "Delete?"%}</th>
</tr>
{% for choice in choices %}<tr>
- <td>&nbsp;</td><td>{{choice.name}}</td><td>{%if choice.limit%}{% blocktrans with choice.limit as choice_limit%}Limited to {{choice_limit}} vote(s){% endblocktrans %}{%endif%}</td><td><input type='checkbox' name='delete_{{choice.id}}'/></td>
+ <td>&nbsp;</td><td><input type='text' name='modify_{{choice.id}}' value="{{choice.name}}"/></td><td>{%if choice.limit%}{% blocktrans with choice.limit as choice_limit%}Limited to {{choice_limit}} vote(s){% endblocktrans %}{%endif%}</td><td><input type='checkbox' name='delete_{{choice.id}}'/></td>
</tr>
{% endfor %}{% endif %}
<tr>
diff --git a/urls.py b/urls.py
index 16fccd0..bda20ee 100644
--- a/urls.py
+++ b/urls.py
@@ -26,6 +26,6 @@ urlpatterns = patterns('',
'papillon.polls.views.createOrEdit'),
(r'^papillon/poll/(?P<poll_url>\w+)/$', 'papillon.polls.views.poll'),
(r'^papillon/poll/(?P<poll_url>\w+)/vote$', 'papillon.polls.views.poll'),
- (r'^static/(?P<path>.*)$', 'django.views.static.serve',
+ (r'^papillon/static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': 'static/'}),
)