aboutsummaryrefslogtreecommitdiff
path: root/forms.py
diff options
context:
space:
mode:
authorAlban Gruin2018-01-17 16:50:08 +0100
committerAlban Gruin2018-01-17 21:32:59 +0100
commit97f62a20f1716a9915358959b2e25912e8b17a90 (patch)
treec4ff9a4c3c45c663875906d2e024d08b103eaba4 /forms.py
parentd2a52ee6844d363ae020a49781b46402d7717a27 (diff)
Utilisation des champs de formulaires date et time à la place de text
Diffstat (limited to 'forms.py')
-rw-r--r--forms.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/forms.py b/forms.py
index d886dbf..0d823eb 100644
--- a/forms.py
+++ b/forms.py
@@ -14,17 +14,21 @@
# along with celcatsanitizer. If not, see <http://www.gnu.org/licenses/>.
from datetime import timedelta
+
from django import forms
+from django.forms.widgets import DateInput, TimeInput
from .utils import tz_now
class QSJPSForm(forms.Form):
- day = forms.DateField(label="Jour")
+ day = forms.DateField(label="Jour", widget=DateInput(attrs={"type": "date"}))
# Ces champs n’acceptent pas les secondes
- begin = forms.TimeField(label="Heure de début", input_formats=("%H:%M",))
- end = forms.TimeField(label="Heure de fin", input_formats=("%H:%M",))
+ begin = forms.TimeField(label="Heure de début", input_formats=("%H:%M",),
+ widget=TimeInput(attrs={"type": "time"}))
+ end = forms.TimeField(label="Heure de fin", input_formats=("%H:%M",),
+ widget=TimeInput(attrs={"type": "time"}))
def __init__(self, *args, **kwargs):
super(QSJPSForm, self).__init__(*args, **kwargs)