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 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 from wtforms.validators import InputRequired, Optional
import ipaddress import ipaddress
...@@ -154,7 +155,7 @@ class MeetingReminderForm(FlaskForm): ...@@ -154,7 +155,7 @@ class MeetingReminderForm(FlaskForm):
class NewProtocolForm(FlaskForm): class NewProtocolForm(FlaskForm):
protocoltype_id = SelectField("Typ", choices=[], coerce=int) 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") start_time = DateTimeField("Uhrzeit (HH:MM, optional)", validators=[Optional()], format="%H:%M")
def __init__(self, protocoltypes, **kwargs): def __init__(self, protocoltypes, **kwargs):
...@@ -195,7 +196,7 @@ def generate_protocol_form(protocol): ...@@ -195,7 +196,7 @@ def generate_protocol_form(protocol):
for meta in protocol.metas: for meta in protocol.metas:
setattr(ProtocolMetasForm, meta.name, StringField(meta.name)) setattr(ProtocolMetasForm, meta.name, StringField(meta.name))
class ProtocolForm(FlaskForm): 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()]) start_time = DateTimeField("Beginn (%H:%M)", format="%H:%M", validators=[Optional()])
end_time = DateTimeField("Ende (%H:%M)", format="%H:%M", validators=[Optional()]) end_time = DateTimeField("Ende (%H:%M)", format="%H:%M", validators=[Optional()])
metas = FormField(ProtocolMetasForm) metas = FormField(ProtocolMetasForm)
...@@ -238,7 +239,7 @@ class NewTodoForm(FlaskForm): ...@@ -238,7 +239,7 @@ class NewTodoForm(FlaskForm):
who = StringField("Person", validators=[InputRequired("Bitte gib an, wer das Todo erledigen soll.")]) 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.")]) description = StringField("Aufgabe", validators=[InputRequired("Bitte gib an, was erledigt werden soll.")])
state = SelectField("Status", choices=[], coerce=coerce_todostate, validators=[CheckTodoDateByState()]) 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): def __init__(self, protocoltypes, **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
...@@ -249,7 +250,7 @@ class TodoForm(FlaskForm): ...@@ -249,7 +250,7 @@ class TodoForm(FlaskForm):
who = StringField("Person") who = StringField("Person")
description = StringField("Aufgabe", validators=[InputRequired("Bitte gib an, was erledigt werden soll.")]) description = StringField("Aufgabe", validators=[InputRequired("Bitte gib an, was erledigt werden soll.")])
state = SelectField("Status", choices=[], coerce=coerce_todostate, validators=[CheckTodoDateByState()]) 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): def __init__(self, **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
......
Supports Markdown
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