Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cfpwordingfix fixes #228

Merged
merged 4 commits into from
Mar 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pybay/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import random
import string

from pathlib import Path

from django import forms
from django.conf import settings
from django.core.mail import EmailMessage
Expand All @@ -16,6 +18,7 @@
from crispy_forms.layout import Layout
from crispy_forms.bootstrap import PrependedText


class CallForProposalForm(forms.Form):
first_name = forms.CharField(label='First Name', max_length=100)
last_name = forms.CharField(label='Last Name', max_length=100)
Expand Down Expand Up @@ -104,14 +107,15 @@ def save_to_models(self):
)

# Create a new talk
themes_csv = ','.join(data['themes'])
proposal = TalkProposal.objects.create(
kind=ProposalKind.objects.get(name='talk'),
title=data['talk_title'],
description=data['description'],
abstract=data['abstract'],
audience_level=data['audience_level'],
speaker=speaker,
category=data['category'],
themes=themes_csv,
talk_length=data['talk_length'],
what_attendees_will_learn=data['what_attendees_will_learn'],
meetup_talk=data['meetup_talk'],
Expand All @@ -121,8 +125,8 @@ def save_to_models(self):
)

# Email submit
with open('%s/proposals/email_confirmation.tmpl' %
settings.PACKAGE_ROOT) as f:
current_directory = Path(__file__).resolve().parent
with open(str(current_directory / "proposals/email_confirmation.tmpl")) as f:
message = f.read().format(**data, **settings.PROJECT_DATA)
email = EmailMessage(
'Your PyBay talk proposal was successfully submitted!',
Expand Down
2 changes: 1 addition & 1 deletion pybay/proposals/email_confirmation.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Name: {first_name} {last_name}
Email: {email}
Speaker Profile: {speaker_bio}
Talk Title: {talk_title}
Category: {category}
Themes: {themes}
Level: {audience_level}
Description: {description}
Abstract: {abstract}
Expand Down
4 changes: 2 additions & 2 deletions pybay/proposals/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Meta:
model = TalkProposal
fields = [
"title",
"category",
"themes",
"audience_level",
"description",
"abstract",
Expand All @@ -41,7 +41,7 @@ class Meta:
model = TutorialProposal
fields = [
"title",
"category",
"themes",
"audience_level",
"description",
"abstract",
Expand Down
4 changes: 2 additions & 2 deletions pybay/proposals/migrations/0016_auto_20180326_0812.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Migration(migrations.Migration):

operations = [
migrations.RunSQL(
sql = "ALTER TABLE `proposals_talkproposal` CHANGE `what_will_attendees_learn` `what_attendees_will_learn` longtext NOT NULL;",
reverse_sql = "ALTER TABLE `proposals_talkproposal` CHANGE `what_attendees_will_learn` `what_will_attendees_learn` longtext NOT NULL;"
sql = "ALTER TABLE `proposals_talkproposal` ADD `what_will_attendees_learn` longtext;",
reverse_sql = "ALTER TABLE `proposals_talkproposal` ADD `what_attendees_will_learn` longtext;"
),
]
5 changes: 4 additions & 1 deletion pybay/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def _get_data(self):
'email': "pirosb3@gmail.com",
'website': "woo.com",
'phone': "+14155289519",
'themes': ['python fundamentals & language internals'],
'themes': ['python fundamentals & popular libraries',
'engineering a community'],
'audience_level': 1,
'talk_length': 25,
'speaker_bio': 'wooo',
Expand Down Expand Up @@ -58,6 +59,8 @@ def test_form_save_models(self):
self.assertEqual(proposal.speaker_and_talk_history, 'wooo2')
self.assertEqual(proposal.talk_links, 'http://google.com')
self.assertEqual(speaker.user.username, "pirosb3@gmail.com")
self.assertEqual('python fundamentals & popular libraries,engineering a community',
proposal.themes)

def test_form_duplicate_profile(self):
form1 = CallForProposalForm(self._get_data())
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ pytz==2015.7
rollbar==0.13.2
six==1.10.0
model-mommy==1.3.2
sqlparse==0.2.4