Extend mil base from super_base template
[edumed.git] / edumed / contact_forms.py
index 89e5121..3ffdded 100644 (file)
@@ -81,3 +81,49 @@ class UdzialForm(ContactForm):
     contact = forms.EmailField(label=u'Adres e-mail', max_length=128)
     telefon = forms.CharField(label=u'Telefon', max_length=32)
     uczestnicy = forms.IntegerField(label=u'Przewidywana liczba uczestników zajęć')
+
+
+class WTEMStudentForm(forms.Form):
+    first_name = forms.CharField(label=u'Imię', max_length=128)
+    last_name = forms.CharField(label=u'Nazwisko', max_length=128)
+    email = forms.EmailField(label=u'Adres e-mail', max_length=128)
+    form_tag = "student"
+
+class NoEmptyFormsAllowedBaseFormSet(forms.formsets.BaseFormSet):
+    """
+    Won't allow formset_factory to be submitted with no forms
+    """
+    def clean(self):
+        for form in self.forms:
+            if form.cleaned_data:
+                return
+        raise forms.ValidationError(u"Proszę podać dane przynajmniej jednego ucznia.")
+
+class WTEMForm(ContactForm):
+    form_tag = "wtem"
+    form_title = u"WTEM - rejestracja uczestników"
+    submit_label = u"Wyślij zgłoszenie"
+    form_formsets = (forms.formsets.formset_factory(WTEMStudentForm, formset=NoEmptyFormsAllowedBaseFormSet),)
+
+    contact = forms.EmailField(label=u'Adres e-mail opiekuna/opiekunki', max_length=128)
+    imie = forms.CharField(label=u'Imię', max_length=128)
+    nazwisko = forms.CharField(label=u'Nazwisko', max_length=128)
+    function = forms.CharField(label=u'Pełniona funkcja', max_length=255)
+    institution = forms.CharField(label=u'Nazwa instytucji', max_length=255)
+    institution_address = forms.CharField(label=u'Adres instytucji', widget=forms.Textarea, max_length=1000)
+    institution_email = forms.EmailField(label=u'Adres e-mail instytucji', max_length=128)
+    institution_phone = forms.CharField(label=u'Telefon do instytucji', max_length=32)
+    institution_www = forms.URLField(label=u'Strona WWW instytucji', max_length=255, required=False)
+
+    zgoda_regulamin = forms.BooleanField(
+        label=u'Znam i akceptuję regulamin Wielkiego Turnieju Edukacji Medialnej.',
+        help_text=u'Zobacz <a href="/media/chunks/attachment/WTEM_regulamin_1.pdf">regulamin Wielkiego Turnieju Edukacji Medialnej</a>.'
+    )
+    potw_uczniowie = forms.BooleanField(
+        label=u'Potwierdzam, że zgłoszeni Uczestnicy/Uczestniczki w chwili rejestracji są uczniami/uczennicami szkoły ponadgimnazjalnej.',
+    )
+    zgoda_informacje = forms.BooleanField(
+        label=u'Wyrażam zgodę na otrzymywanie informacji od Fundacji Nowoczesna Polska związanych z edukacją medialną.',
+        required=False
+    )
+