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):
13 conference_name = u'CopyCamp 2014'
15 form_title = _('Take part!')
16 admin_list = ['name', 'organization', 'title']
18 name = forms.CharField(label=_('Name'), max_length=128)
19 contact = forms.EmailField(label=_('E-mail'), max_length=128)
20 organization = forms.CharField(label=_('Organization'),
21 max_length=256, required=False)
22 title = forms.CharField(label=_('Title of presentation'),
23 max_length=256, required=False)
24 presentation = forms.FileField(label=_('Presentation'),
26 summary = forms.CharField(label=_('Summary of presentation (max. 1800 characters)'),
27 max_length=1800, required=False)
28 agree_data = forms.BooleanField(
29 label=_('Permission for data processing'),
30 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.')
32 agree_license = forms.BooleanField(
33 label=_('Permission for publication'),
34 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.')
37 def __init__(self, *args, **kwargs):
38 super(RegistrationForm, self).__init__(*args, **kwargs)
40 self.started = getattr(settings, 'REGISTRATION_STARTED', False)
41 self.open_call = getattr(settings, 'REGISTRATION_OPEN_CALL', False)
42 self.limit_reached = Contact.objects.filter(form_tag=self.save_as_tag).count() >= settings.REGISTRATION_LIMIT
43 if self.limit_reached:
44 for field in ('title', 'summary'):
45 self.fields[field].required = True
46 if not self.open_call:
47 for field in ('title', 'summary', 'presentation'):
48 del self.fields[field]
51 class NextForm(ContactForm):
53 form_title = _('Next CopyCamp')
55 name = forms.CharField(label=_('Name'), max_length=128)
56 contact = forms.EmailField(label=_('E-mail'), max_length=128)
57 organization = forms.CharField(label=_('Organization'),
58 max_length=256, required=False)