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
d6d3efaf
Commit
d6d3efaf
authored
Jun 23, 2010
by
christophe siraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Travail de fond sur les dates
parent
6a598147
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
9 deletions
+17
-9
sondage/forms.py
sondage/forms.py
+1
-1
sondage/models.py
sondage/models.py
+11
-2
sondage/views.py
sondage/views.py
+0
-1
templates/sondage/choice_form.html
templates/sondage/choice_form.html
+2
-2
templates/sondage/poll_detail.html
templates/sondage/poll_detail.html
+3
-3
No files found.
sondage/forms.py
View file @
d6d3efaf
...
@@ -8,7 +8,7 @@ class PollForm(forms.ModelForm):
...
@@ -8,7 +8,7 @@ class PollForm(forms.ModelForm):
fields
=
(
'title'
,
'description'
)
fields
=
(
'title'
,
'description'
)
class
ChoiceForm
(
forms
.
ModelForm
):
class
ChoiceForm
(
forms
.
ModelForm
):
choice
=
forms
.
Char
Field
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
'hasdatepicker'
,
'size'
:
'1
0
'
,}))
choice
=
forms
.
Date
Field
(
widget
=
forms
.
DateTimeInput
(
format
=
'%d-%m-%Y'
,
attrs
=
{
'class'
:
'hasdatepicker'
,
'size'
:
'1
2
'
,})
,
input_formats
=
[
'%d-%m-%Y'
]
)
details
=
forms
.
CharField
(
required
=
False
,
widget
=
forms
.
TextInput
(
attrs
=
{
'size'
:
'32'
,}))
details
=
forms
.
CharField
(
required
=
False
,
widget
=
forms
.
TextInput
(
attrs
=
{
'size'
:
'32'
,}))
class
Meta
:
class
Meta
:
model
=
Choice
model
=
Choice
...
...
sondage/models.py
View file @
d6d3efaf
...
@@ -22,8 +22,17 @@ class Poll(models.Model):
...
@@ -22,8 +22,17 @@ class Poll(models.Model):
class
Choice
(
models
.
Model
):
class
Choice
(
models
.
Model
):
poll
=
models
.
ForeignKey
(
Poll
)
poll
=
models
.
ForeignKey
(
Poll
)
choice
=
models
.
CharField
(
max_length
=
20
)
choice
=
models
.
DateField
()
details
=
models
.
CharField
(
max_length
=
30
,
blank
=
True
)
details
=
models
.
CharField
(
max_length
=
120
,
blank
=
True
)
votecount
=
models
.
IntegerField
(
default
=
0
,
blank
=
True
)
def
__unicode__
(
self
):
return
str
(
self
.
choice
)
# hacky?
class
NodateChoice
(
models
.
Model
):
poll
=
models
.
ForeignKey
(
Poll
)
choice
=
models
.
CharField
(
max_length
=
80
)
details
=
models
.
CharField
(
max_length
=
120
,
blank
=
True
)
votecount
=
models
.
IntegerField
(
default
=
0
,
blank
=
True
)
votecount
=
models
.
IntegerField
(
default
=
0
,
blank
=
True
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
...
...
sondage/views.py
View file @
d6d3efaf
...
@@ -4,7 +4,6 @@ import datetime
...
@@ -4,7 +4,6 @@ import datetime
from
django.http
import
HttpResponse
,
HttpResponseRedirect
from
django.http
import
HttpResponse
,
HttpResponseRedirect
from
django.shortcuts
import
get_object_or_404
,
render_to_response
from
django.shortcuts
import
get_object_or_404
,
render_to_response
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
#from django.template import Context, loader, RequestContext
from
django.template
import
RequestContext
from
django.template
import
RequestContext
from
django.forms.formsets
import
formset_factory
from
django.forms.formsets
import
formset_factory
from
django.forms.models
import
inlineformset_factory
,
BaseInlineFormSet
from
django.forms.models
import
inlineformset_factory
,
BaseInlineFormSet
...
...
templates/sondage/choice_form.html
View file @
d6d3efaf
...
@@ -23,9 +23,9 @@
...
@@ -23,9 +23,9 @@
$
(
this
).
removeClass
(
'
hasdatepicker
'
);
// remove hasDatepicker class
$
(
this
).
removeClass
(
'
hasdatepicker
'
);
// remove hasDatepicker class
// re-init datepicker
// re-init datepicker
$
(
this
).
datepicker
({
$
(
this
).
datepicker
({
dateFormat
:
'
dd-mm
'
,
dateFormat
:
'
dd-mm
-yy
'
,
//showButtonPanel: true,
//showButtonPanel: true,
showOn
:
'
b
oth
'
,
//'b
utton
',
showOn
:
'
b
utton
'
,
//'b
oth
',
buttonImage
:
'
/static/images/calendar.png
'
,
buttonImage
:
'
/static/images/calendar.png
'
,
buttonImageOnly
:
true
,
buttonImageOnly
:
true
,
minDate
:
'
+1d
'
,
minDate
:
'
+1d
'
,
...
...
templates/sondage/poll_detail.html
View file @
d6d3efaf
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
{% block chapeau %}
{% block chapeau %}
<h3>
{{object}}
</h3>
<h3>
{{object}}
</h3>
<p
class=
"info"
>
<p
class=
"info"
>
{{object.description}}
<br
/>
{% trans "Posted by" %}
<code>
{{object.author}}
</code>
{% trans "on" %}
<code>
{{object.pub_date}}
</code><br
/>
{% trans "Shared address" %}:
<input
type=
"text"
name=
"link"
value=
"{{ current_site }}"
readonly=
"readonly"
class=
'adresse'
style=
"border: 1px solid #efefff;"
/>
{{object.description}}
<br
/>
{% trans "Posted by" %}
<code>
{{object.author}}
</code>
{% trans "on" %}
<code>
{{object.pub_date
|date:"d F"
}}
</code>
.
<br
/>
{% trans "Shared address" %}:
<input
type=
"text"
name=
"link"
value=
"{{ current_site }}"
readonly=
"readonly"
class=
'adresse'
style=
"border: 1px solid #efefff;"
/>
</p>
</p>
{% endblock %}
{% endblock %}
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<tr><td
class=
'names'
></td>
<tr><td
class=
'names'
></td>
{% for choice in object.choice_set.all %}
{% for choice in object.choice_set.all %}
<td
class=
'cell'
title=
"{{ choice.details }}"
onmouseover=
"toggle_visibility('info-{{ choice }}');"
onmouseout=
"toggle_visibility('info-{{ choice }}');"
>
{{ choice.choice }}
</td>
<td
class=
'cell'
title=
"{{ choice.details }}"
onmouseover=
"toggle_visibility('info-{{ choice }}');"
onmouseout=
"toggle_visibility('info-{{ choice }}');"
>
{{ choice.choice
|date:"d-m"
}}
</td>
{% endfor %}
{% endfor %}
<td></td>
<td></td>
<td></td>
<td></td>
...
@@ -121,7 +121,7 @@
...
@@ -121,7 +121,7 @@
{% block helper %}
{% block helper %}
{% for choice in object.choice_set.all %}
{% for choice in object.choice_set.all %}
<p
class=
'helper'
id=
'info-{{ choice }}'
>
<p
class=
'helper'
id=
'info-{{ choice }}'
>
<b>
{{ choice
}}
</b>
<br
/>
<span
class=
"blue"
>
{{ choice.details }}
</span>
<br
/>
<b>
{{ choice
.choice|date:"l d F"
}}
</b>
<br
/>
<span
class=
"blue"
>
{{ choice.details }}
</span>
<br
/>
{% for bulletin in object.bulletin_set.all %}
{% for bulletin in object.bulletin_set.all %}
{% for vote in bulletin.vote_set.all %}
{% for vote in bulletin.vote_set.all %}
...
...
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