1 # -*- coding: utf-8 -*-
2 from django.conf import settings
3 from django import forms
4 from contact.forms import ContactForm
5 from contact.models import Contact
6 from django.utils.translation import ugettext_lazy as _
9 class RegistrationForm(ContactForm):
11 form_title = _('Take part!')
12 admin_list = ['name', 'organization', 'title']
14 name = forms.CharField(label=_('Name'), max_length=128)
15 contact = forms.EmailField(label=_('E-mail'), max_length=128)
16 organization = forms.CharField(label=_('Organization'),
17 max_length=256, required=False)
18 title = forms.CharField(label=_('Title of presentation'),
19 max_length=256, required=False, widget = forms.HiddenInput)
20 presentation = forms.FileField(label=_('Presentation'),
21 required=False, widget = forms.HiddenInput)
22 summary = forms.CharField(label=_('Summary of presentation (max. 1800 characters)'),
23 widget=forms.HiddenInput, max_length=1800, required=False)
24 agree_data = forms.BooleanField(
25 label=_('Permission for data processing'),
26 help_text=_(u'I hereby grant Modern Poland Foundation (Fundacja Nowoczesna Polska, ul. MarszaĆkowska 84/92, 00-514 Warszawa) permission to process my personal data (name, e-mail address) for purposes of registration for CopyCamp conference.')
28 agree_license = forms.BooleanField(
29 label=_('Permission for publication'),
30 help_text=_('I agree to having materials recorded during the conference released under the terms of <a href="http://creativecommons.org/licenses/by-sa/3.0/deed">CC BY-SA</a> license.')
33 def __init__(self, *args, **kwargs):
34 super(RegistrationForm, self).__init__(*args, **kwargs)
35 self.limit_reached = Contact.objects.filter(form_tag=self.form_tag).count() >= settings.REGISTRATION_LIMIT
36 if self.limit_reached:
37 for field in ('title', 'summary'):
38 self.fields[field].required = True