diff --git a/seminar/forms.py b/seminar/forms.py index be722e16..e45c50f6 100644 --- a/seminar/forms.py +++ b/seminar/forms.py @@ -10,6 +10,13 @@ import seminar.models as m from datetime import date import logging +class DateInput(forms.DateInput): + input_type = 'date' + +class TelInput(forms.TextInput): + input_type = 'tel' + input_pattern="^[+]?[()/0-9. -]{9,}$" + class LoginForm(forms.Form): username = forms.CharField(label='Přihlašovací jméno', max_length=256, @@ -42,8 +49,8 @@ class PrihlaskaForm(forms.Form): pohlavi_muz = forms.ChoiceField(label='Pohlaví', choices = ((True,'muž'),(False,'žena')), required=True) email = forms.EmailField(label='E-mail',max_length=256, required=True) - telefon = forms.CharField(label='Telefon',max_length=256, required=False) - datum_narozeni = forms.DateField(label='Datum narození', required=False) + telefon = forms.CharField(widget=TelInput(),label='Telefon',max_length=256, required=False) + datum_narozeni = forms.DateField(widget=DateInput(),label='Datum narození', required=False) ulice = forms.CharField(label='Ulice', max_length=256, required=False) mesto = forms.CharField(label='Město', max_length=256, required=False) psc = forms.CharField(label='PSČ', max_length=32, required=False) @@ -135,8 +142,8 @@ class ProfileEditForm(forms.Form): pohlavi_muz = forms.ChoiceField(label='Pohlaví', choices = ((True,'muž'),(False,'žena')), required=True) email = forms.EmailField(label='E-mail',max_length=256, required=True) - telefon = forms.CharField(label='Telefon',max_length=256, required=False) - datum_narozeni = forms.DateField(label='Datum narození', required=False) + telefon = forms.CharField(widget=TelInput(),label='Telefon',max_length=256, required=False) + datum_narozeni = forms.DateField(widget=DateInput(),label='Datum narození', required=False) ulice = forms.CharField(label='Ulice', max_length=256, required=False) mesto = forms.CharField(label='Město', max_length=256, required=False) psc = forms.CharField(label='PSČ', max_length=32, required=False) @@ -234,7 +241,7 @@ class VlozReseniForm(forms.Form): #resitele = models.ManyToManyField(Resitel, verbose_name='autoři řešení', # help_text='Seznam autorů řešení', through='Reseni_Resitele') - cas_doruceni = forms.DateField(label="Čas doručení") + cas_doruceni = forms.DateField(widget=DateInput(),label="Čas doručení") #cas_doruceni = models.DateTimeField('čas_doručení', default=timezone.now, blank=True)