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