Choose your day.
[prawokultury.git] / prawokultury / contact_forms.py
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 _
7 from django.utils.safestring import mark_safe
8 from migdal.models import Entry
9
10
11 class RegistrationForm(ContactForm):
12     form_tag = 'register'
13
14     save_as_tag = '2014'
15     conference_name = u'CopyCamp 2014' 
16     
17     form_title = _('Take part!')
18     admin_list = ['name', 'organization', 'title']
19
20     name = forms.CharField(label=_('Name'), max_length=128)
21     contact = forms.EmailField(label=_('E-mail'), max_length=128)
22     organization = forms.CharField(label=_('Organization'), 
23             max_length=256, required=False)
24
25     days = forms.ChoiceField(
26         label = _("I'm planning to show up on"),
27         choices=[
28             ('both', _('Both days of the conference')),
29             ('only-6th', _('November 6th only')),
30             ('only-7th', _('November 7th only')),
31         ], widget=forms.RadioSelect())
32     
33     agree_mailing = forms.BooleanField(
34         label=_('I am interested in receiving information about the Modern Poland Foundation\'s activities by e-mail'),
35         required=False
36     )
37     agree_data = forms.BooleanField(
38         label=_('Permission for data processing'),
39         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.')
40     )
41     agree_license = forms.BooleanField(
42         label=_('Permission for publication'),
43         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 and to publishing my image.'),
44         required=False
45     )
46
47     def __init__(self, *args, **kwargs):
48         super(RegistrationForm, self).__init__(*args, **kwargs)
49         self.started = getattr(settings, 'REGISTRATION_STARTED', False)
50         self.limit_reached = Contact.objects.filter(form_tag=self.save_as_tag).count() >= settings.REGISTRATION_LIMIT
51         try:
52             url = Entry.objects.get(slug_pl='regulamin').get_absolute_url()
53             self.fields['agree_toc'] = forms.BooleanField(
54                 required = True,
55                 label = mark_safe(_('I accept <a href="%s">Terms and Conditions of CopyCamp</a>') % url)
56             )
57         except Entry.DoesNotExist:
58             pass
59
60
61 tracks = (
62     _('CopyArt'),
63     _('Creative Middle Class'),
64     _('How to Pay?'),
65     _('How to Be Paid?'),
66     _('Copyright and Education'),
67     _('Technology and Innovation'),
68     _('Copyright and Human Rights'),
69     _('Self-Publishing'),
70     _('Future of the Book'),
71     _('Copyright Enforcement'),
72     _('Future of Copyright'),
73     _('Copyright Debate')
74 )
75
76 class RegisterSpeaker(RegistrationForm):
77     form_tag = 'register-speaker'
78     save_as_tag = '2014-speaker'
79
80     thematic_track = forms.ChoiceField(
81         label = _('Please select one thematic track'),
82         choices=[(t,t) for t in tracks], widget=forms.RadioSelect())
83
84     bio = forms.CharField(label=_('Short biographical note (max. 500 characters)'),
85             widget=forms.Textarea, max_length=500, required=True)
86
87     title = forms.CharField(label=_('Title of presentation'),
88             max_length=256, required=True)
89     presentation = forms.FileField(label=_('Presentation'),
90             required=False)
91     summary = forms.CharField(label=_('Summary of presentation (max. 1800 characters)'),
92             widget=forms.Textarea, max_length=1800, required=True)
93
94     post_conference_publication = forms.BooleanField(
95         label=_('I am interested in including my paper in the post-conference publication'),
96         required=False
97     )
98
99     def __init__(self, *args, **kw):
100         super(RegisterSpeaker, self).__init__(*args, **kw)
101         self.closed = getattr(settings, 'REGISTRATION_SPEAKER_CLOSED', False)
102         self.fields.keyOrder = [
103             'name',
104             'contact',
105             'organization',
106             'thematic_track',
107             'bio',
108             'title',
109             'presentation',
110             'summary',
111             'post_conference_publication',
112             'agree_mailing',
113             'agree_data',
114             'agree_license'
115         ]
116
117
118 class NextForm(ContactForm):
119     form_tag = 'next'
120     form_title = _('Next CopyCamp')
121
122     name = forms.CharField(label=_('Name'), max_length=128)
123     contact = forms.EmailField(label=_('E-mail'), max_length=128)
124     organization = forms.CharField(label=_('Organization'),
125             max_length=256, required=False)
126