Changeset - 1de0a5d46ab9
[Not reviewed]
0 3 1
Christopher Neugebauer - 7 years ago 2017-08-13 19:31:22
chrisjrn@gmail.com
Adds ConferenceSpeaker model to Symposion
4 files changed with 131 insertions and 1 deletions:
0 comments (0 inline, 0 general)
pinaxcon/proposals/forms.py
Show inline comments
 
from django import forms
 

	
 
from .models import TalkProposal
 
from .models import ConferenceSpeaker, TalkProposal
 

	
 

	
 
class ConferenceSpeakerForm(forms.ModelForm):
 

	
 
    class Meta:
 
        model = ConferenceSpeaker
 
        exclude = [
 
            'user',
 
            'biography_html',
 
            'experience_html',
 
            'invite_email',
 
            'invite_token',
 
            'annotation',
 
        ]
 

	
 
    def __init__(self, *a, **k):
 
        super(ConferenceSpeakerForm, self).__init__(*a, **k)
 
        self.fields['code_of_conduct'].required = True
 

	
 

	
 

	
 
class ProposalForm(forms.ModelForm):
 

	
 
    def clean_description(self):
 
        value = self.cleaned_data["description"]
 
        if len(value) > 400:
 
            raise forms.ValidationError(
 
                u"The description must be less than 400 characters"
 
            )
 
        return value
 

	
 

	
 
class TalkProposalForm(ProposalForm):
 

	
 
    class Meta:
 
        model = TalkProposal
 
        fields = [
 
            "title",
 
            "audience_level",
 
            "description",
 
            "abstract",
 
            "additional_notes",
 
            "recording_release",
pinaxcon/proposals/migrations/0002_conferencespeaker.py
Show inline comments
 
new file 100644
 
# -*- coding: utf-8 -*-
 
# Generated by Django 1.11.4 on 2017-08-13 18:45
 
from __future__ import unicode_literals
 

	
 
from django.db import migrations, models
 
import django.db.models.deletion
 

	
 

	
 
class Migration(migrations.Migration):
 

	
 
    dependencies = [
 
        ('symposion_speakers', '0007_auto_20170810_1651'),
 
        ('proposals', '0001_initial'),
 
    ]
 

	
 
    operations = [
 
        migrations.CreateModel(
 
            name='ConferenceSpeaker',
 
            fields=[
 
                ('speakerbase_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='symposion_speakers.SpeakerBase')),
 
                ('twitter_username', models.CharField(blank=True, help_text='Your Twitter account', max_length=15)),
 
                ('first_time', models.BooleanField(help_text='')),
 
                ('experience', models.TextField(blank=True, help_text="List any past speaking experience you have.  Edit using <a href='http://warpedvisions.org/projects/markdown-cheat-sheet/target='_blank'>Markdown</a>.", verbose_name='Past speaking experience')),
 
                ('experience_html', models.TextField(blank=True)),
 
                ('travel_assistance', models.BooleanField(help_text='Check this field if you require travel assistance to get to North Bay Python in Petaluma, California.')),
 
                ('lodging_assistance', models.BooleanField(help_text='Check this field if you require lodging assistance in Petaluma, California during North Bay Python.')),
 
                ('home_city', models.CharField(blank=True, help_text='Which city (and state, and country) will you be traveling from to get to North Bay Python?', max_length=127)),
 
                ('minority_group', models.CharField(blank=True, help_text='If you are a member of one or more groups that are underrepresented in the tech industry, you may list these here. Your response is optional.', max_length=256, verbose_name='Diversity statement')),
 
                ('code_of_conduct', models.BooleanField(help_text="I have read and, in the event that my proposal is accepted, agree that I will comply with the <a href='/code-of-conduct'>Code of Conduct</a>.")),
 
            ],
 
            bases=('symposion_speakers.speakerbase',),
 
        ),
 
    ]
pinaxcon/proposals/models.py
Show inline comments
 
from django.db import models
 
from django.utils.translation import ugettext_lazy as _
 

	
 
from symposion.markdown_parser import parse
 
from symposion.proposals.models import ProposalBase
 
from symposion.speakers.models import SpeakerBase
 

	
 

	
 

	
 
class ConferenceSpeaker(SpeakerBase):
 

	
 
    def clean_twitter_username(self):
 
        value = self.twitter_username
 
        if value.startswith("@"):
 
            value = value[1:]
 
        return value
 

	
 
    def save(self, *args, **kwargs):
 
        self.experience_html = parse(self.experience)
 
        self.twitter_username = self.clean_twitter_username()
 
        return super(ConferenceSpeaker, self).save(*args, **kwargs)
 

	
 
    twitter_username = models.CharField(
 
        max_length=15,
 
        blank=True,
 
        help_text=_(u"Your Twitter account")
 
    )
 

	
 
    first_time = models.BooleanField(
 
        blank=True,
 
        verbose_name=_("First-time speaker?"),
 
        help_text=_("Check this field if this is your first time speaking "
 
                    "at a technical conference."),
 
        )
 

	
 
    experience = models.TextField(blank=True, help_text=_
 
        ("List any past speaking experience you have. This can include "
 
         "user groups, meetups, or presentations at work or school.  Edit "
 
         "using <a href='http://warpedvisions.org/projects/"
 
         "markdown-cheat-sheet/target='_blank'>"
 
         "Markdown</a>."),
 
         verbose_name=_("Past speaking experience"),
 
    )
 
    experience_html = models.TextField(blank=True)
 

	
 
    travel_assistance = models.BooleanField(
 
        blank=True,
 
        verbose_name=_("Travel assistance required?"),
 
        help_text=_("Check this field if you require travel assistance to get "
 
                    "to North Bay Python in Petaluma, California."),
 
    )
 

	
 
    lodging_assistance = models.BooleanField(
 
        blank=True,
 
        verbose_name=_("Lodging assistance required?"),
 
        help_text=_("Check this field if you require lodging assistance in "
 
                    "Petaluma, California during North Bay Python."),
 
    )
 

	
 
    home_city = models.CharField(
 
        blank=True,
 
        max_length=127,
 
        help_text=_("Which city (and state, and country) will you be "
 
                    "traveling from to get to North Bay Python?"),
 
    )
 

	
 
    minority_group = models.CharField(blank=True, max_length=256,
 
        verbose_name=_("Diversity statement"),
 
        help_text=_("If you are a member of one or more groups that are "
 
                    "under-represented in the tech industry, you may list "
 
                    "these here. Your response is optional."),
 
    )
 

	
 
    code_of_conduct = models.BooleanField(
 
        help_text=_("I have read and, in the event that my proposal is "
 
                    "accepted, agree that I will comply with the "
 
                    "<a href='/code-of-conduct'>Code of Conduct</a>."),
 
    )
 

	
 

	
 
class Proposal(ProposalBase):
 

	
 
    AUDIENCE_LEVEL_NOVICE = 1
 
    AUDIENCE_LEVEL_EXPERIENCED = 2
 
    AUDIENCE_LEVEL_INTERMEDIATE = 3
 

	
 
    AUDIENCE_LEVELS = [
 
        (AUDIENCE_LEVEL_NOVICE, "Novice"),
 
        (AUDIENCE_LEVEL_INTERMEDIATE, "Intermediate"),
 
        (AUDIENCE_LEVEL_EXPERIENCED, "Experienced"),
 
    ]
 

	
 
    audience_level = models.IntegerField(choices=AUDIENCE_LEVELS)
 

	
 
    recording_release = models.BooleanField(
 
        default=True,
 
        help_text="By submitting your proposal, you agree to give permission to the conference organizers to record, edit, and release audio and/or video of your presentation. If you do not agree to this, please uncheck this box."
 
    )
 

	
 
    class Meta:
 
        abstract = True
 

	
pinaxcon/settings.py
Show inline comments
...
 
@@ -235,48 +235,51 @@ EMAIL_USE_SSL = bool(os.environ.get("DJANGO_EMAIL_USE_SSL", False))
 
ACCOUNT_OPEN_SIGNUP = bool(os.environ.get("DJANGO_ACCOUNT_OPEN_SIGNUP", False))
 
ACCOUNT_EMAIL_UNIQUE = True
 
ACCOUNT_EMAIL_CONFIRMATION_REQUIRED = False if DEBUG else True
 
ACCOUNT_LOGIN_REDIRECT_URL = "home"
 
ACCOUNT_LOGOUT_REDIRECT_URL = "home"
 
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 2
 
ACCOUNT_USE_AUTH_AUTHENTICATE = True
 

	
 
AUTHENTICATION_BACKENDS = [
 
    "symposion.teams.backends.TeamPermissionsBackend",
 
    "account.auth_backends.UsernameAuthenticationBackend",
 
]
 

	
 
CONFERENCE_ID = 1
 
PROPOSAL_FORMS = {
 
    "talk": "pinaxcon.proposals.forms.TalkProposalForm",
 
}
 
PINAX_PAGES_HOOKSET = "pinaxcon.hooks.PinaxPagesHookSet"
 
PINAX_BOXES_HOOKSET = "pinaxcon.hooks.PinaxBoxesHookSet"
 

	
 
PINAX_STRIPE_PUBLIC_KEY = os.environ.get("STRIPE_PUBLIC_KEY", "your test public key")
 
PINAX_STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY", "your test secret key")
 
PINAX_STRIPE_SEND_EMAIL_RECEIPTS = False
 

	
 
SYMPOSION_SPEAKER_MODEL = "pinaxcon.proposals.models.ConferenceSpeaker"
 
SYMPOSION_SPEAKER_FORM = "pinaxcon.proposals.forms.ConferenceSpeakerForm"
 

	
 
# Registrasion Attendee profile model
 
ATTENDEE_PROFILE_MODEL = "pinaxcon.registrasion.models.AttendeeProfile"
 
# Registrasion attendee profile form -- must act on ATTENDEE_PROFILE_FORM
 
# You only need to provide this if you're customising the form from the default
 
# ATTENDEE_PROFILE_FORM = "pinaxcon.registrasion.forms.ProfileForm"
 

	
 
# Ticket product category -- used to identify which products must be available
 
# in order to register.
 
TICKET_PRODUCT_CATEGORY = 1
 

	
 

	
 
INVOICE_CURRENCY = "AUD"
 

	
 
# Use nose to run all tests
 
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
 

	
 

	
 
# Tell nose to measure coverage on the 'foo' and 'bar' apps
 
NOSE_ARGS = [
 
    '--with-coverage',
 
    '--cover-package=registrasion.controllers,registrasion.models',
 
]
 

	
 
MARKDOWN_DEUX_STYLES = {
0 comments (0 inline, 0 general)