Commit b5c3fc77 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Merge branch '136-html5-date-input-fur-datumsfelder-verwenden'

parents 32f2e108 9c4dc8f8
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, DateField, HiddenField, IntegerField, SelectField, FileField, DateTimeField, TextAreaField, Field, widgets, FormField
from wtforms import StringField, PasswordField, BooleanField, HiddenField, IntegerField, SelectField, FileField, DateTimeField, TextAreaField, Field, widgets, FormField
from wtforms.fields.html5 import DateField
from wtforms.validators import InputRequired, Optional
import ipaddress
......@@ -154,7 +155,7 @@ class MeetingReminderForm(FlaskForm):
class NewProtocolForm(FlaskForm):
protocoltype_id = SelectField("Typ", choices=[], coerce=int)
date = DateField("Datum (dd.mm.yyyy)", validators=[InputRequired("Du musst ein Datum angeben.")], format="%d.%m.%Y")
date = DateField("Datum", validators=[InputRequired("Du musst ein Datum angeben.")])
start_time = DateTimeField("Uhrzeit (HH:MM, optional)", validators=[Optional()], format="%H:%M")
def __init__(self, protocoltypes, **kwargs):
......@@ -195,7 +196,7 @@ def generate_protocol_form(protocol):
for meta in protocol.metas:
setattr(ProtocolMetasForm, meta.name, StringField(meta.name))
class ProtocolForm(FlaskForm):
date = DateField("Datum (dd.mm.yyyy)", validators=[InputRequired("Bitte gib das Datum des Protkolls an.")], format="%d.%m.%Y")
date = DateField("Datum", validators=[InputRequired("Bitte gib das Datum des Protkolls an.")])
start_time = DateTimeField("Beginn (%H:%M)", format="%H:%M", validators=[Optional()])
end_time = DateTimeField("Ende (%H:%M)", format="%H:%M", validators=[Optional()])
metas = FormField(ProtocolMetasForm)
......@@ -238,7 +239,7 @@ class NewTodoForm(FlaskForm):
who = StringField("Person", validators=[InputRequired("Bitte gib an, wer das Todo erledigen soll.")])
description = StringField("Aufgabe", validators=[InputRequired("Bitte gib an, was erledigt werden soll.")])
state = SelectField("Status", choices=[], coerce=coerce_todostate, validators=[CheckTodoDateByState()])
date = DateField("Datum (dd.mm.yyyy)", format="%d.%m.%Y", validators=[Optional()])
date = DateField("Datum)", validators=[Optional()])
def __init__(self, protocoltypes, **kwargs):
super().__init__(**kwargs)
......@@ -249,7 +250,7 @@ class TodoForm(FlaskForm):
who = StringField("Person")
description = StringField("Aufgabe", validators=[InputRequired("Bitte gib an, was erledigt werden soll.")])
state = SelectField("Status", choices=[], coerce=coerce_todostate, validators=[CheckTodoDateByState()])
date = DateField("Datum (dd.mm.yyyy)", format="%d.%m.%Y", validators=[Optional()])
date = DateField("Datum", validators=[Optional()])
def __init__(self, **kwargs):
super().__init__(**kwargs)
......
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