Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
etch
nuages
Commits
fe56165b
Commit
fe56165b
authored
Oct 07, 2010
by
chris
Browse files
Correctif: dates en désordre (bug 611)
parent
16e3ce0e
Changes
4
Hide whitespace changes
Inline
Side-by-side
sondage/userviews.py
View file @
fe56165b
...
...
@@ -19,6 +19,6 @@ def register(request):
def
clear_cookie
(
request
,
poll_id
):
request
.
session
.
clear
()
return
HttpResponseRedirect
(
reverse
(
'
nuages.
sondage.views.vote'
,
args
=
(
poll_id
,)))
return
HttpResponseRedirect
(
reverse
(
'sondage.views.vote'
,
args
=
(
poll_id
,)))
sondage/views.py
View file @
fe56165b
...
...
@@ -79,7 +79,6 @@ def editchoices(request, poll_id):
instances
=
OrderedItemFormset
(
request
.
POST
,
instance
=
poll
)
if
instances
.
is_valid
():
for
instance
in
instances
.
cleaned_data
:
try
:
this_choice
=
instance
[
'choice'
]
if
not
instance
.
get
(
'DELETE'
):
...
...
@@ -91,6 +90,12 @@ def editchoices(request, poll_id):
except
(
KeyError
,
Choice
.
DoesNotExist
):
choice
=
Choice
(
poll
=
poll
,
choice
=
instance
[
'choice'
],
details
=
instance
[
'details'
])
choice
.
save
()
# If bulletins for this poll existed before edition
# add an 'false' vote child to them for newly created choice.
# This makes template computation easier
for
bulletin
in
Bulletin
.
objects
.
filter
(
poll
=
poll
):
nvote
=
Vote
(
choice
=
choice
,
bulletin
=
bulletin
,
voice
=
False
)
nvote
.
save
()
else
:
try
:
choice
=
Choice
.
objects
.
get
(
poll
=
poll
,
choice
=
this_choice
)
...
...
@@ -104,7 +109,8 @@ def editchoices(request, poll_id):
except
:
pass
except
:
pass
# probably an empty datefield?
pass
redir
=
'/'
+
str
(
poll
.
id
)
+
'/'
return
HttpResponseRedirect
(
redir
)
else
:
...
...
templates/sondage/choice_form.html
View file @
fe56165b
...
...
@@ -89,12 +89,12 @@
</tr>
</thead>
<!-- vforms.management_form -->
{% for v in vforms.forms %}
<tr
id=
"{{ v.prefix }}-row"
>
<td>
{
{ v.management_form }
}
{
% for hidden in v.hidden_fields %} {{ hidden }} {% endfor %
}
{% if v.instance.pk %}{{ v.DELETE }}{% endif %}
{{ v.choice.errors }}{{ v.choice }}
</td>
...
...
templates/sondage/poll_detail.html
View file @
fe56165b
...
...
@@ -24,7 +24,7 @@
<table>
<tr><td
class=
'names'
></td>
{% for choice in object.choice_set.all %}
{% for choice in object.choice_set.all
|dictsort:'choice'
%}
<td
class=
'cell'
title=
"{{ choice.choice|date:"
l
d
F
"}}{{
choice.details
}}"
onmouseover=
"toggle_visibility('info-{{ choice }}');"
onmouseout=
"toggle_visibility('info-{{ choice }}');"
>
{{ choice.choice|date:"d-m" }}
</td>
{% endfor %}
<td></td>
...
...
@@ -33,7 +33,7 @@
{% for bulletin in object.bulletin_set.all %}
<tr
><td
class=
'names'
>
{{ bulletin.voter }}
</td>
{% for vote in bulletin.vote_set.all %}
{% for vote in bulletin.vote_set.all
|dictsort:'choice.choice'
%}
<td
class=
'cell'
title=
"{{ vote.comment }}"
onmouseover=
"toggle_visibility('info-{{ vote.choice }}');"
onmouseout=
"toggle_visibility('info-{{ vote.choice }}');"
><div
class=
"{{ vote.voice }}"
>
{% if vote.comment %} ° {% endif %}
</div></td>
{% endfor %}
...
...
@@ -43,7 +43,7 @@
<tr><td
class=
'names'
></td>
{% for choice in object.choice_set.all %}
{% for choice in object.choice_set.all
|dictsort:'choice'
%}
<td
class=
'cell'
title=
"{{ choice }}"
>
{{ choice.votecount }}
</td>
{% endfor %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment