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
 
  11 class RegistrationForm(ContactForm):
 
  15     conference_name = u'CopyCamp 2014' 
 
  17     form_title = _('Take part!')
 
  18     admin_list = ['name', 'organization', 'title']
 
  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)
 
  25     days = forms.ChoiceField(
 
  26         label = _("I'm planning to show up on"),
 
  28             ('both', _('Both days of the conference')),
 
  29             ('only-6th', _('November 6th only')),
 
  30             ('only-7th', _('November 7th only')),
 
  31         ], widget=forms.RadioSelect())
 
  33     agree_mailing = forms.BooleanField(
 
  34         label=_('I am interested in receiving information about the Modern Poland Foundation\'s activities by e-mail'),
 
  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.')
 
  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.'),
 
  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
 
  52             url = Entry.objects.get(slug_pl='regulamin').get_absolute_url()
 
  53             self.fields['agree_toc'] = forms.BooleanField(
 
  55                 label = mark_safe(_('I accept <a href="%s">Terms and Conditions of CopyCamp</a>') % url)
 
  57         except Entry.DoesNotExist:
 
  63     _('Creative Middle Class'),
 
  66     _('Copyright and Education'),
 
  67     _('Technology and Innovation'),
 
  68     _('Copyright and Human Rights'),
 
  70     _('Future of the Book'),
 
  71     _('Copyright Enforcement'),
 
  72     _('Future of Copyright'),
 
  76 class RegisterSpeaker(RegistrationForm):
 
  77     form_tag = 'register-speaker'
 
  78     save_as_tag = '2014-speaker'
 
  80     thematic_track = forms.ChoiceField(
 
  81         label = _('Please select one thematic track'),
 
  82         choices=[(t,t) for t in tracks], widget=forms.RadioSelect())
 
  84     bio = forms.CharField(label=_('Short biographical note (max. 500 characters)'),
 
  85             widget=forms.Textarea, max_length=500, required=True)
 
  87     title = forms.CharField(label=_('Title of presentation'),
 
  88             max_length=256, required=True)
 
  89     presentation = forms.FileField(label=_('Presentation'),
 
  91     summary = forms.CharField(label=_('Summary of presentation (max. 1800 characters)'),
 
  92             widget=forms.Textarea, max_length=1800, required=True)
 
  94     post_conference_publication = forms.BooleanField(
 
  95         label=_('I am interested in including my paper in the post-conference publication'),
 
  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 = [
 
 111             'post_conference_publication',
 
 118 class NextForm(ContactForm):
 
 120     form_title = _('Next CopyCamp')
 
 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)