Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
etch
nuages
Commits
6384a4a3
Commit
6384a4a3
authored
Oct 08, 2010
by
chris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Meilleure approche pour ordonner les dates (mais pas encore les votes)
parent
057f182c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
sondage/models.py
sondage/models.py
+2
-1
sondage/views.py
sondage/views.py
+2
-2
templates/sondage/poll_detail.html
templates/sondage/poll_detail.html
+2
-2
No files found.
sondage/models.py
View file @
6384a4a3
...
...
@@ -24,7 +24,8 @@ class Choice(models.Model):
choice
=
models
.
DateField
()
details
=
models
.
CharField
(
max_length
=
200
,
blank
=
True
)
votecount
=
models
.
IntegerField
(
default
=
0
,
blank
=
True
)
class
Meta
:
ordering
=
[
'choice'
]
def
__unicode__
(
self
):
return
str
(
self
.
choice
)
# hacky?
...
...
sondage/views.py
View file @
6384a4a3
...
...
@@ -153,7 +153,7 @@ def vote(request, poll_id):
if
request
.
method
==
'POST'
:
form
=
BulletinForm
(
request
.
POST
,
initial
=
{
'poll'
:
poll
.
id
,})
vforms
=
[
[
VoteForm
(
request
.
POST
,
prefix
=
choice
)
]
for
choice
in
Choice
.
objects
.
filter
(
poll
=
poll
.
id
)
.
order_by
(
'choice'
)
]
vforms
=
[
[
VoteForm
(
request
.
POST
,
prefix
=
choice
)
]
for
choice
in
Choice
.
objects
.
filter
(
poll
=
poll
.
id
)
]
if
form
.
is_valid
():
if
request
.
user
.
is_authenticated
():
...
...
@@ -233,7 +233,7 @@ def vote(request, poll_id):
vforms
=
[
[
VoteForm
(
initial
=
{
'choice'
:
choice
,
'voice'
:
True
,},
prefix
=
choice
)
]
for
choice
in
Choice
.
objects
.
filter
(
poll
=
poll_id
)
]
else
:
# Default formset for unknown user
vforms
=
[
[
VoteForm
(
initial
=
{
'choice'
:
choice
,},
prefix
=
choice
)
]
for
choice
in
Choice
.
objects
.
filter
(
poll
=
poll_id
)
.
order_by
(
'choice'
)
]
vforms
=
[
[
VoteForm
(
initial
=
{
'choice'
:
choice
,},
prefix
=
choice
)
]
for
choice
in
Choice
.
objects
.
filter
(
poll
=
poll_id
)
]
if
request
.
user
.
is_authenticated
():
voter
=
str
(
request
.
user
)
try
:
...
...
templates/sondage/poll_detail.html
View file @
6384a4a3
...
...
@@ -24,7 +24,7 @@
<table>
<tr><td
class=
'names'
></td>
{% for choice in object.choice_set.all
|dictsort:'choice'
%}
{% for choice in object.choice_set.all %}
<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>
...
...
@@ -43,7 +43,7 @@
<tr><td
class=
'names'
></td>
{% for choice in object.choice_set.all
|dictsort:'choice'
%}
{% for choice in object.choice_set.all %}
<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