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):
fields = ('title','description')
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',}))
class Meta:
model = Choice
......
......@@ -22,8 +22,17 @@ class Poll(models.Model):
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=20)
details = models.CharField(max_length=30,blank=True)
choice = models.DateField()
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)
def __unicode__(self):
......
......@@ -4,7 +4,6 @@ import datetime
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render_to_response
from django.core.urlresolvers import reverse
#from django.template import Context, loader, RequestContext
from django.template import RequestContext
from django.forms.formsets import formset_factory
from django.forms.models import inlineformset_factory, BaseInlineFormSet
......
......@@ -23,9 +23,9 @@
$(this).removeClass('hasdatepicker'); // remove hasDatepicker class
// re-init datepicker
$(this).datepicker({
dateFormat: 'dd-mm',
dateFormat: 'dd-mm-yy',
//showButtonPanel: true,
showOn: 'both', //'button',
showOn: 'button', //'both',
buttonImage: '/static/images/calendar.png',
buttonImageOnly: true,
minDate: '+1d',
......
......@@ -6,7 +6,7 @@
{% block chapeau %}
<h3>{{object}}</h3>
<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>
{% endblock %}
......@@ -19,7 +19,7 @@
<tr><td class='names'></td>
{% 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 %}
<td></td>
<td></td>
......@@ -121,7 +121,7 @@
{% block helper %}
{% for choice in object.choice_set.all %}
<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 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