# Path: conference/cfp/forms.py
# class TalkSubmissionForm(forms.ModelForm):
# 
#     class Meta:
#         model = Submission
#         fields = (
#             'author', 'email', 'author_bio', 'proposal_title',
#             'proposal_abstract', 'proposal_why', 'proposal_requirements', 'proposal_audience',
#             'mentor_wanted', 'mentor_offer', 'notes', 'pycon'
#         )
# 
#     def __init__(self, *args, **kwargs):
#         super(TalkSubmissionForm, self).__init__(*args, **kwargs)
#         self.fields['author'].label = _('Your name')
#         self.fields['email'].label = _('Your email')
#         self.fields['author_bio'].label = _('Tell us about yourself')
#         self.fields['proposal_title'].label = _('Your proposal\'s title')
#         self.fields['proposal_abstract'].label = _('Abstract of your proposal')
#         self.fields['proposal_why'].label = _('What the audience will get from your proposal?')
#         self.fields['proposal_requirements'].label = _(
#             'Do you have any special requirement for your talk?'
#         )
#         self.fields['proposal_audience'].label = _(
#             'What\'s the intended audience of your proposal?')
#         self.fields['mentor_wanted'].label = _('I\'d like a mentor')
#         self.fields['mentor_offer'].label = _('I\'m volunteering as mentor')
#         self.fields['pycon'].label = _('Do you want to submit your proposal to PyCon Italia 2017?')
# 
# Path: conference/cfp/models.py
# class Submission(AbstractSubmission):
#     proposal_why = models.TextField(
#         _('Motivation'),
#         help_text=_('Explain here why your proposal is important for the attendees and what they will get from it.')
#     )
#     proposal_requirements = models.TextField(
#         _('Requirements'), blank=False, default='',
#     )
#     mentor_wanted = models.BooleanField(
#         _('Mentor'), default=False,
#         help_text=_('More experienced speakers can help you reviewing your talk, '
#                     'practicing, and getting ready for the presentation')
#     )
#     mentor_offer = models.BooleanField(
#         _('Mentor - Offer'), default=False,
#         help_text=_('Are you an experienced speaker and are you willing to help other speakers? '
#                     'Select this and we will get in contact with you!')
#     )
#     pycon = models.BooleanField(
#         _('PyCon'), default=False,
#         help_text=_('We will share your proposal with the PyCon Italia Team and they will '
#                     'evaluate independently your proposal.')
#     )
# 
#     class Meta:
#         verbose_name = _('talk submission')
#         verbose_name_plural = _('talk submissions')
# 
# Path: conference/cfp/views.py
# class SubmissionView(CreateView):
#     thanks_page = 'thanks_cfp'
#     closed_page = 'closed_cfp'
#     closing_date = settings.CFP_CLOSING_DATE
# 
#     def _send_notification(self):
#         if self.object:
#             with open(os.path.join(settings.STATIC_ROOT, 'css', 'style.css'), 'r') as css_file:
#                 css = css_file.read()
#             context = {
#                 'css': css,
#                 'instance': self.object
#             }
#             email = MagicMailBuilder()
#             notification = email.submission_notification(self.object.email, context)
#             notification.send()
# 
#     def get_success_url(self):
#         self._send_notification()
#         try:
#             return Page.objects.public().get(reverse_id=self.thanks_page).get_absolute_url()
#         except Page.DoesNotExist:
#             return Page.objects.public().get_home().get_absolute_url()
# 
#     def get(self, request, *args, **kwargs):
#         if is_cfp_closed(self.closing_date):
#             redirect_url = Page.objects.public().get(reverse_id=self.closed_page).get_absolute_url()
#             return HttpResponseRedirect(redirect_url)
#         return super(SubmissionView, self).get(request, *args, **kwargs)


from django.conf.urls import url
from .forms import TalkSubmissionForm
from .models import Submission
from .views import SubmissionView
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals



urlpatterns = [
    url(r'^', SubmissionView.as_view(

# Path: conference/cfp/forms.py
# class TalkSubmissionForm(forms.ModelForm):
# 
#     class Meta:
#         model = Submission
#         fields = (
#             'author', 'email', 'author_bio', 'proposal_title',
#             'proposal_abstract', 'proposal_why', 'proposal_requirements', 'proposal_audience',
#             'mentor_wanted', 'mentor_offer', 'notes', 'pycon'
#         )
# 
#     def __init__(self, *args, **kwargs):
#         super(TalkSubmissionForm, self).__init__(*args, **kwargs)
#         self.fields['author'].label = _('Your name')
#         self.fields['email'].label = _('Your email')
#         self.fields['author_bio'].label = _('Tell us about yourself')
#         self.fields['proposal_title'].label = _('Your proposal\'s title')
#         self.fields['proposal_abstract'].label = _('Abstract of your proposal')
#         self.fields['proposal_why'].label = _('What the audience will get from your proposal?')
#         self.fields['proposal_requirements'].label = _(
#             'Do you have any special requirement for your talk?'
#         )
#         self.fields['proposal_audience'].label = _(
#             'What\'s the intended audience of your proposal?')
#         self.fields['mentor_wanted'].label = _('I\'d like a mentor')
#         self.fields['mentor_offer'].label = _('I\'m volunteering as mentor')
#         self.fields['pycon'].label = _('Do you want to submit your proposal to PyCon Italia 2017?')
# 
# Path: conference/cfp/models.py
# class Submission(AbstractSubmission):
#     proposal_why = models.TextField(
#         _('Motivation'),
#         help_text=_('Explain here why your proposal is important for the attendees and what they will get from it.')
#     )
#     proposal_requirements = models.TextField(
#         _('Requirements'), blank=False, default='',
#     )
#     mentor_wanted = models.BooleanField(
#         _('Mentor'), default=False,
#         help_text=_('More experienced speakers can help you reviewing your talk, '
#                     'practicing, and getting ready for the presentation')
#     )
#     mentor_offer = models.BooleanField(
#         _('Mentor - Offer'), default=False,
#         help_text=_('Are you an experienced speaker and are you willing to help other speakers? '
#                     'Select this and we will get in contact with you!')
#     )
#     pycon = models.BooleanField(
#         _('PyCon'), default=False,
#         help_text=_('We will share your proposal with the PyCon Italia Team and they will '
#                     'evaluate independently your proposal.')
#     )
# 
#     class Meta:
#         verbose_name = _('talk submission')
#         verbose_name_plural = _('talk submissions')
# 
# Path: conference/cfp/views.py
# class SubmissionView(CreateView):
#     thanks_page = 'thanks_cfp'
#     closed_page = 'closed_cfp'
#     closing_date = settings.CFP_CLOSING_DATE
# 
#     def _send_notification(self):
#         if self.object:
#             with open(os.path.join(settings.STATIC_ROOT, 'css', 'style.css'), 'r') as css_file:
#                 css = css_file.read()
#             context = {
#                 'css': css,
#                 'instance': self.object
#             }
#             email = MagicMailBuilder()
#             notification = email.submission_notification(self.object.email, context)
#             notification.send()
# 
#     def get_success_url(self):
#         self._send_notification()
#         try:
#             return Page.objects.public().get(reverse_id=self.thanks_page).get_absolute_url()
#         except Page.DoesNotExist:
#             return Page.objects.public().get_home().get_absolute_url()
# 
#     def get(self, request, *args, **kwargs):
#         if is_cfp_closed(self.closing_date):
#             redirect_url = Page.objects.public().get(reverse_id=self.closed_page).get_absolute_url()
#             return HttpResponseRedirect(redirect_url)
#         return super(SubmissionView, self).get(request, *args, **kwargs)


# Path: conference/cfp/urls.py
from django.conf.urls import url
from .forms import TalkSubmissionForm
from .models import Submission
from .views import SubmissionView

# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals



urlpatterns = [
    url(r'^', SubmissionView.as_view(

        form_class=TalkSubmissionForm, model=Submission