Commit 3623d525 authored by chris's avatar chris

Travail de fond sur les dates

parent 0f4603ec
No preview for this file type
...@@ -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.CharField(widget=forms.TextInput(attrs={'class':'hasdatepicker','size':'10',})) choice = forms.DateField(widget=forms.DateTimeInput(format='%d-%m-%Y',attrs={'class':'hasdatepicker','size':'12',}),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
......
...@@ -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):
......
...@@ -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
......
...@@ -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: 'both', //'button', showOn: 'button', //'both',
buttonImage: '/static/images/calendar.png', buttonImage: '/static/images/calendar.png',
buttonImageOnly: true, buttonImageOnly: true,
minDate: '+1d', minDate: '+1d',
......
...@@ -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 %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment