1 # -*- coding: utf-8 -*-
2 from __future__ import unicode_literals
4 from django.conf import settings
5 from django import forms
6 from django.core.mail import send_mail
8 from contact.forms import ContactForm
9 from contact.models import Contact
10 from contact.fields import HeaderField
11 from django.utils.functional import lazy
12 from django.utils.translation import ugettext_noop as _
13 from django.utils.safestring import mark_safe
14 from migdal.models import Entry
16 from prawokultury.countries import COUNTRIES, TRAVEL_GRANT_COUNTRIES
18 mark_safe_lazy = lazy(mark_safe, unicode)
21 class RegistrationForm(ContactForm):
25 conference_name = u'CopyCamp 2017'
26 notify_on_register = False
28 form_title = _('Registration')
29 admin_list = ['first_name', 'last_name', 'organization']
31 mailing_field = 'agree_mailing'
33 travel_grant_countries = TRAVEL_GRANT_COUNTRIES
35 first_name = forms.CharField(label=_('First name'), max_length=128)
36 last_name = forms.CharField(label=_('Last name'), max_length=128)
37 contact = forms.EmailField(label=_('E-mail'), max_length=128)
38 organization = forms.CharField(label=_('Organization'), max_length=256, required=False)
39 country = forms.ChoiceField(label=_('Country of residence'), choices=zip(COUNTRIES, COUNTRIES))
40 travel_grant = forms.BooleanField(
41 label=_('I require financial assistance to attend CopyCamp 2017.'), required=False)
42 travel_grant_motivation = forms.CharField(
43 label=_('Please write us about yourself and why you want to come to CopyCamp. '
44 'This information will help us evaluate your travel grant application:'),
45 help_text=_('Financial assistance for German audience is possible '
46 'thanks to the funds of the German Federal Foreign Office transferred by '
47 'the Foundation for Polish-German Cooperation.'),
48 widget=forms.Textarea, max_length=600, required=False)
50 days = forms.ChoiceField(
51 label=_("I'm planning to show up on"),
53 ('both', _('Both days of the conference')),
54 ('only-28th', _('September 28th only')),
55 ('only-29th', _('September 29th only')),
56 ], widget=forms.RadioSelect())
59 times_attended = forms.ChoiceField(
61 label=_("1. How many times have you attended CopyCamp?"),
66 ('3', _('three times')),
67 ('4', _('four times')),
68 ('5', _('five times')),
69 ], widget=forms.RadioSelect())
70 age = forms.ChoiceField(
72 label=_("2. Please indicate your age bracket:"),
74 ('0-19', _('19 or below')),
75 ('20-25', _('20-25')),
76 ('26-35', _('26-35')),
77 ('36-45', _('36-45')),
78 ('46-55', _('46-55')),
79 ('56-65', _('56-65')),
80 ('66+', _('66 or above')),
81 ], widget=forms.RadioSelect())
82 areas = forms.MultipleChoiceField(
84 label=_("3. Please indicate up to 3 areas you feel most affiliated with"),
86 ('sztuki plastyczne', _('visual art')),
87 ('literatura', _('literature')),
88 ('muzyka', _('music')),
89 ('teatr', _('theatre')),
90 ('film', _('film production')),
91 ('wydawanie', _('publishing')),
93 ('ekonomia', _('economy')),
94 ('socjologia', _('sociology')),
95 ('technika', _('technology')),
96 ('edukacja', _('education')),
97 ('studia', _('higher education')),
98 ('nauka', _('academic research')),
99 ('biblioteki', _('library science')),
100 ('administracja', _('public administration')),
101 ('ngo', _('nonprofit organisations')),
102 ('other', _('other (please specify below)')),
103 ], widget=forms.CheckboxSelectMultiple())
104 areas_other = forms.CharField(required=False, label=_('Fill if you selected “other” above'))
105 source = forms.ChoiceField(
107 label=_("4. Please indicate how you received information about the conference:"),
109 ('znajomi', _('through friends sharing on the web')),
110 ('znajomi2', _('through friends by other means')),
111 ('prasa', _('through press')),
112 ('fnp', _('directly through the Foundation\'s facebook or website')),
113 ('www', _('through other websites (please specify below)')),
114 ('other', _('other (please specify below)')),
115 ], widget=forms.RadioSelect())
116 source_other = forms.CharField(required=False, label=_('Fill if you selected “other” or “other website” above'))
117 motivation = forms.ChoiceField(
119 label=_("6. Please indicate the most important factor for your willingness to participate:"),
121 ('speaker', _('listening to particular speaker(s)')),
122 ('networking', _('good networking occasion')),
123 ('partnering', _('partnering with organisations present at the event')),
124 ('other', _('other (please specify below)')),
125 ], widget=forms.RadioSelect())
126 motivation_other = forms.CharField(required=False, label=_('Fill if you selected “other” above'))
128 agree_mailing = forms.BooleanField(
129 label=_('I am interested in receiving information about the Modern Poland Foundation\'s activities by e-mail'),
132 agree_data = forms.BooleanField(
133 label=_('Permission for data processing'),
135 u'I hereby grant Modern Poland Foundation (Fundacja Nowoczesna Polska, ul. Marszałkowska 84/92, '
136 u'00-514 Warszawa) permission to process my personal data (name, e-mail address) for purposes '
137 u'of registration for CopyCamp conference.')
139 agree_license = forms.BooleanField(
140 label=_('Permission for publication'),
141 help_text=mark_safe_lazy(_(
142 u'I agree to having materials, recorded during the conference, released under the terms of '
143 u'<a href="http://creativecommons.org/licenses/by-sa/3.0/deed">CC\u00a0BY-SA</a> license and '
144 u'to publishing my image.')),
148 def __init__(self, *args, **kwargs):
149 super(RegistrationForm, self).__init__(*args, **kwargs)
150 self.started = getattr(settings, 'REGISTRATION_STARTED', False)
151 self.limit_reached = Contact.objects.filter(form_tag=self.save_as_tag).count() >= settings.REGISTRATION_LIMIT
153 url = Entry.objects.get(slug_pl='regulamin').get_absolute_url()
154 self.fields['agree_toc'] = forms.BooleanField(
156 label=mark_safe(_('I accept <a href="%s">Terms and Conditions of CopyCamp</a>') % url)
158 except Entry.DoesNotExist:
161 def clean_areas(self):
162 data = self.cleaned_data['areas']
164 raise forms.ValidationError(_('Select at most 3 areas'))
168 cleaned_data = self.cleaned_data
169 country = cleaned_data['country']
170 travel_grant = cleaned_data['travel_grant']
171 motivation = cleaned_data['travel_grant_motivation']
172 if country not in self.travel_grant_countries and travel_grant:
173 raise forms.ValidationError(_('Travel grant is not provided for the selected country'))
174 if travel_grant and not motivation:
175 self._errors['travel_grant_motivation'] = _('Please provide this information')
176 raise forms.ValidationError(_('To apply for a travel grant you must provide additional information.'))
177 if not travel_grant and motivation:
178 cleaned_data['motivation'] = ''
181 def main_fields(self):
182 return [self[name] for name in (
183 'first_name', 'last_name', 'contact', 'organization', 'country',
184 'travel_grant', 'travel_grant_motivation', 'days')]
186 def survey_fields(self):
187 return [self[name] for name in (
188 'times_attended', 'age',
189 'areas', 'areas_other', 'source', 'source_other', 'motivation', 'motivation_other')]
191 def agreement_fields(self):
192 return [self[name] for name in ('agree_mailing', 'agree_data', 'agree_license', 'agree_toc')]
196 (_('business models, heritage digitization, remix'),
197 _('What are the boundaries of appropriation in culture? '
198 'Who owns the past and whether these exclusive rights allow to '
199 'control present and future? How to make money from creativity without selling yourself?')),
200 (_('health, food, security, and exclusive rights'),
201 _('Who owns medicines and equipment necessary to provide health care? '
202 'Who owns grain and machines used to harvest it? '
203 'To what extent exclusive rights can affect what you eat, '
204 'how you exercise, whether you can apply a specific treatment?')),
205 (_('text and data mining, machine learning, online education'),
206 _('Do you think own the data you feed to algorithms? Or maybe you think you own these algorithms? '
207 'What if you can’t mine the data because you actually don’t own any of those rights? '
208 'What does it mean to own data about someone, or data necessary for that person’s education?')),
209 (_('IoT: autonomous cars, smart homes, wearables'),
210 _('What does it mean to own exclusive rights to software and data used to construct autonomous agents? '
211 'What will it mean in a near future?')),
212 (_('hacking government data, public procurement, public aid in culture'),
213 _('Who owns information created using public money? How can this information be appropriated? '
214 'What is the role of government in the development of information infrastructure?')),
218 class RegisterSpeaker(RegistrationForm):
219 form_tag = 'register-speaker'
220 save_as_tag = '2017-speaker'
221 form_title = _('Open call for presentations')
222 notify_on_register = False
223 mailing_field = 'agree_mailing'
225 # inherited fields included so they are not translated
226 first_name = forms.CharField(label=_('First name'), max_length=128)
227 last_name = forms.CharField(label=_('Last name'), max_length=128)
228 organization = forms.CharField(label=_('Organization'), max_length=256, required=False)
229 agree_mailing = forms.BooleanField(
230 label=_('I am interested in receiving information about the Modern Poland Foundation\'s activities by e-mail'),
233 agree_license = forms.BooleanField(
234 label=_('Permission for publication'),
235 help_text=mark_safe_lazy(_(
236 u'I agree to having materials, recorded during the conference, released under the terms of '
237 u'<a href="http://creativecommons.org/licenses/by-sa/3.0/deed">CC\u00a0BY-SA</a> license and '
238 u'to publishing my image.')),
242 presentation_thematic_track = forms.ChoiceField(
243 label=_('Please select one thematic track'),
245 (t, mark_safe('<strong>%s</strong><p style="margin-left: 20px;">%s</p>' % (t, desc)))
246 for t, desc in tracks],
247 widget=forms.RadioSelect())
249 bio = forms.CharField(label=_('Short biographical note in English (max. 500 characters)'), widget=forms.Textarea,
250 max_length=500, required=False)
251 photo = forms.FileField(label=_('Photo'), required=False)
252 phone = forms.CharField(label=_('Phone number'), max_length=64,
254 help_text=_('Used only for organizational purposes.'))
256 presentation_title = forms.CharField(
257 label=mark_safe_lazy(_('Title of the presentation in English')),
258 max_length=256, required=False)
259 presentation_summary = forms.CharField(label=_('Summary of presentation (max. 1800 characters)'),
260 widget=forms.Textarea, max_length=1800)
262 # presentation_post_conference_publication = forms.BooleanField(
263 # label=_('I am interested in including my paper in the post-conference publication'),
269 agree_terms = forms.BooleanField(
270 label=mark_safe_lazy(_(u'I accept <a href="/en/info/terms-and-conditions/">'
271 u'CopyCamp Terms and Conditions</a>.'))
274 # workshop = forms.BooleanField(label=_('Workshop'), required=False)
275 # workshop_title = forms.CharField(label=_('Title of workshop'),
276 # max_length=256, required=False)
277 # workshop_summary = forms.CharField(label=_('Summary of workshop (max. 1800 characters)'),
278 # widget=forms.Textarea, max_length=1800, required=False)
280 def __init__(self, *args, **kw):
281 super(RegisterSpeaker, self).__init__(*args, **kw)
282 self.started = getattr(settings, 'REGISTRATION_SPEAKER_STARTED', False)
283 self.closed = getattr(settings, 'REGISTRATION_SPEAKER_CLOSED', False)
284 self.fields.keyOrder = [
292 'presentation_title',
293 'presentation_summary',
294 'presentation_thematic_track',
295 # 'presentation_post_conference_publication',
298 # 'workshop_summary',
307 class RemindForm(ContactForm):
308 form_tag = 'remind-me'
309 save_as_tag = 'remind-me-2018'
310 form_title = u'CopyCamp 2018'
311 notify_on_register = False
315 class NextForm(ContactForm):
317 form_title = _('Next CopyCamp')
319 name = forms.CharField(label=_('Name'), max_length=128)
320 contact = forms.EmailField(label=_('E-mail'), max_length=128)
321 organization = forms.CharField(label=_('Organization'),
322 max_length=256, required=False)
325 def workshop_field(label):
326 return forms.BooleanField(label=_(label), required=False)
329 class WorkshopForm(ContactForm):
330 form_tag = 'workshops'
331 save_as_tag = 'workshops-2017'
332 conference_name = u'CopyCamp 2017'
333 form_title = _('Workshop')
334 notify_on_register = False
335 mailing_field = 'agree_mailing'
337 first_name = forms.CharField(label=_('First name'), max_length=128)
338 last_name = forms.CharField(label=_('Last name'), max_length=128)
339 contact = forms.EmailField(label=_('E-mail'), max_length=128)
340 organization = forms.CharField(label=_('Organization'), max_length=256, required=False)
341 country = forms.CharField(label=_('Country'), max_length=128)
343 _header = HeaderField(
344 label=mark_safe_lazy(_("<h3>I'll take a part in workshops</h3>")),
345 help_text=_('Only workshops with any spots left are visible here.'))
347 _h1 = HeaderField(label=mark_safe_lazy(_("<strong>Thursday, September 28th, 10 a.m.–12 noon</strong>")))
349 w_mileszyk = workshop_field(
350 u'Natalia Mileszyk, Dimitar Dimitrov, Diego Naranjo: School of Rock(ing) Copyright: United to #fixcopyright')
351 w_wang = workshop_field(
352 u'Jacob Riddersholm Wang, Pernille Feldt, Martin Appelt: Heritage gone digital - beyond legal rights')
354 _h2 = HeaderField(label=mark_safe_lazy(_("<strong>Thursday, September 28th, 12 noon–2 p.m.</strong>")))
356 w_vanderwaal = workshop_field(u'Sander van der Waal, Danny Lämmerhirt: Tackling open license proliferation')
358 _h2a = HeaderField(label=mark_safe_lazy(_("<strong>Friday, September 29th, 9 a.m.–11 noon</strong>")))
360 w_nobre = workshop_field(u'Teresa Nobre, Paul Keller, Sean Flynn: Researching the Impact of Copyright User Rights')
361 w_nobre_question = forms.CharField(
362 label=mark_safe_lazy(_(
363 u'Please describe the most important recent changes to copyright user rights in your national law. '
364 u'(max 1500 characters)')),
365 max_length=1500, widget=forms.Textarea, required=False)
367 _h3 = HeaderField(label=mark_safe_lazy(_("<strong>Friday, September 29th, 10 a.m.–12 noon</strong>")))
369 w_youtube = workshop_field(
370 u'Kiki Ganzemüller: YouTube Songwriter Workshop: Rights Management & Building a Presence on YouTube')
372 _h4 = HeaderField(label=mark_safe_lazy(_("<strong>Friday, September 29th, 12 noon–2 p.m.</strong>")))
374 w_murray = workshop_field(
375 u'Peter Murray-Rust: Wikidata, ContentMine and the automatic liberation of factual data: '
376 u'(The Right to Read is the Right To Mine)') # 30
378 w_zimmermann = workshop_field(u'Jeremie Zimmermann: Hackers ethics and peer-to-peer philosophy in care')
380 _header_1 = HeaderField(label='')
381 _header_2 = HeaderField(label='')
383 start_workshops = ('mileszyk', 'wang', 'vanderwaal', 'nobre', 'youtube', 'murray', 'zimmermann')
386 ('_h1', 'mileszyk', 'wang'),
387 ('_h2', 'vanderwaal'),
388 ('_h2a', 'nobre', '_h3', 'youtube'),
389 ('_h4', 'murray', 'zimmermann'),
402 agree_mailing = forms.BooleanField(
403 label=_('I am interested in receiving information about the Modern Poland Foundation\'s activities by e-mail'),
405 agree_data = forms.BooleanField(
406 label=_('Permission for data processing'),
408 u'I hereby grant Modern Poland Foundation (Fundacja Nowoczesna Polska, ul. Marszałkowska 84/92, '
409 u'00-514 Warszawa) permission to process my personal data (name, e-mail address) for purposes of '
410 u'registration for CopyCamp conference.'))
411 agree_license = forms.BooleanField(
412 label=_('Permission for publication'),
413 help_text=mark_safe_lazy(_(
414 u'I agree to having materials, recorded during the conference, released under the terms of '
415 u'<a href="http://creativecommons.org/licenses/by-sa/3.0/deed">CC\u00a0BY-SA</a> '
416 u'license and to publishing my image.')),
419 def __init__(self, *args, **kwargs):
420 super(WorkshopForm, self).__init__(*args, **kwargs)
422 url = Entry.objects.get(slug_pl='regulamin').get_absolute_url()
423 self.fields['agree_toc'] = forms.BooleanField(
425 label=mark_safe(_('I accept <a href="%s">Terms and Conditions of CopyCamp</a>') % url)
427 except Entry.DoesNotExist:
429 counts = {k: 0 for k in self.start_workshops}
430 for contact in Contact.objects.filter(form_tag=self.save_as_tag):
431 for workshop in self.start_workshops:
432 if contact.body.get('w_%s' % workshop, False):
433 counts[workshop] += 1
434 if workshop == 'youtube' and counts[workshop] == 30:
435 send_mail(u'Warsztaty YouTube', u'Przekroczono limit 30 osób na warsztaty YouTube',
436 'no-reply@copycamp.pl',
437 ['krzysztof.siewicz@nowoczesnapolska.org.pl'],
441 for k, v in counts.items():
442 if v >= self.limits[k]:
444 if 'w_%s' % k in self.fields:
445 del self.fields['w_%s' % k]
447 self.fields['_header'].help_text = None
450 for slot in self.slots:
451 if sum(1 for w in slot if self.cleaned_data.get('w_%s' % w)) > 1:
452 self._errors[slot[0]] = [_("You can't choose more than one workshop during the same period")]
453 if not any(self.cleaned_data.get('w_%s' % w) for w in self.start_workshops):
454 self._errors['_header'] = [_("Please choose at least one workshop.")]
455 return self.cleaned_data