X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/736d94f6ac63f205be2967f013a15c457032fc2f..5d79e48732565dad23a8592eeebc8741972ef5cc:/edumed/contact_forms.py diff --git a/edumed/contact_forms.py b/edumed/contact_forms.py index 507c6d1..0ff8415 100644 --- a/edumed/contact_forms.py +++ b/edumed/contact_forms.py @@ -101,6 +101,8 @@ class NoEmptyFormsAllowedBaseFormSet(forms.formsets.BaseFormSet): raise forms.ValidationError(u"Proszę podać dane przynajmniej jednego ucznia.") class WTEMForm(ContactForm): + disabled = True + disabled_template = 'wtem/disabled_contact_form.html' form_tag = "wtem" form_title = u"WTEM - rejestracja uczestników" submit_label = u"Wyślij zgłoszenie" @@ -118,8 +120,13 @@ class WTEMForm(ContactForm): zgoda_regulamin = forms.BooleanField( label=u'Znam i akceptuję regulamin Wielkiego Turnieju Edukacji Medialnej.', - help_text=u'Zobacz regulamin Wielkiego Turnieju Edukacji Medialnej.' + help_text=u'Zobacz regulamin Wielkiego Turnieju Edukacji Medialnej.' ) + zgoda_dane = forms.BooleanField( + label=u'Wyrażam zgodę na przetwarzanie moich danych osobowych oraz danych osobowych moich podopiecznych, a także na publikację prac na wolnej licencji.', + help_text=u'Zobacz pełną treść oświadczenia.' + ) + potw_uczniowie = forms.BooleanField( label=u'Potwierdzam, że zgłoszeni Uczestnicy/Uczestniczki w chwili rejestracji są uczniami/uczennicami szkoły ponadgimnazjalnej.', ) @@ -128,6 +135,37 @@ class WTEMForm(ContactForm): required=False ) + extract_types = (dict(slug='extended', label=_('extended')),) + + @staticmethod + def get_extract_fields(contact, extract_type_slug): + fields = contact.body.keys() + fields.pop(fields.index('student')) + fields.extend(['contact', 'student_first_name', 'student_last_name', 'student_email']) + return fields + + @staticmethod + def get_extract_records(keys, contact, extract_type_slug): + toret = [dict()] + for field_name in keys: + if field_name.startswith('student_'): + continue + if field_name == 'contact': + val = contact.contact + else: + val = contact.body[field_name] + toret[0][field_name] = val + + current = toret[0] + for student in contact.body['student']: + for attr in ('first_name', 'last_name', 'email'): + current['student_' + attr] = student[attr] + if not current in toret: + toret.append(current) + current = dict() + return toret + + class MILForm(ContactForm): form_tag = 'mil' form_title = _('Share your thoughts on the "Media and information literacy competencies catalogue"')