Skip to content

Commit 4c522c5

Browse files
Added First Time Speaker field to the create proposal page (#710)
* Add `First Time Speaker` field in create proposal page - Add `is_first_time_speaker` field in proposal form & model - Update proposals/views.py - Add first time speaker checkbox field in proposals/detail/base.html - Add migration for Proposal model * Update help_text parameter of is_first_time_speaker field in proposal/forms.py * Fix linting error * Update proposal base.html for first time speaker * Update proposal form's help text for is_first_time_speaker field * Update base.html & forms.py of proposal page - Show first time speaker label on proposal page only to author & reviewer - Reorder first time speaker checkbox in proposal form * Remove unwanted characters & extra lines
1 parent ac9d951 commit 4c522c5

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

junction/proposals/forms.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ class ProposalForm(forms.Form):
136136
required=False,
137137
help_text="Say something about yourself, work etc...",
138138
)
139+
is_first_time_speaker = forms.BooleanField(
140+
label="First Time Speaker",
141+
required=False,
142+
help_text="Please mark, if you are a first time speaker for any conference or meetup,"
143+
"not just for PyCon India",
144+
)
139145
speaker_links = forms.CharField(
140146
label="Speaker Links",
141147
widget=PagedownWidget(show_preview=True),
@@ -165,6 +171,7 @@ def populate_form_for_update(self, proposal):
165171
"content_urls": proposal.content_urls,
166172
"speaker_info": proposal.speaker_info,
167173
"speaker_links": proposal.speaker_links,
174+
"is_first_time_speaker": proposal.is_first_time_speaker,
168175
"status": proposal.status,
169176
"proposal_section": proposal.proposal_section.pk,
170177
"proposal_type": proposal.proposal_type.pk,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.9 on 2020-07-07 03:14
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
("proposals", "0028_auto_20200617_2337"),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name="historicalproposal",
17+
name="is_first_time_speaker",
18+
field=models.BooleanField(default=False),
19+
),
20+
migrations.AddField(
21+
model_name="proposal",
22+
name="is_first_time_speaker",
23+
field=models.BooleanField(default=False),
24+
),
25+
]

junction/proposals/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class Proposal(TimeAuditModel):
107107
content_urls = models.TextField(blank=True, default="")
108108
speaker_info = models.TextField(blank=True, default="")
109109
speaker_links = models.TextField(blank=True, default="")
110+
is_first_time_speaker = models.BooleanField(blank=True, default=False)
110111
status = models.PositiveSmallIntegerField(
111112
choices=ProposalStatus.CHOICES, default=ProposalStatus.DRAFT
112113
)

junction/proposals/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ def create_proposal(request, conference_slug):
173173
content_urls=form.cleaned_data["content_urls"],
174174
speaker_info=form.cleaned_data["speaker_info"],
175175
speaker_links=form.cleaned_data["speaker_links"],
176+
is_first_time_speaker=form.cleaned_data["is_first_time_speaker"],
176177
status=form.cleaned_data["status"],
177178
proposal_type_id=form.cleaned_data["proposal_type"],
178179
proposal_section_id=form.cleaned_data["proposal_section"],
@@ -324,6 +325,7 @@ def update_proposal(request, conference_slug, slug):
324325
proposal.content_urls = form.cleaned_data["content_urls"]
325326
proposal.speaker_info = form.cleaned_data["speaker_info"]
326327
proposal.speaker_links = form.cleaned_data["speaker_links"]
328+
proposal.is_first_time_speaker = form.cleaned_data["is_first_time_speaker"]
327329
proposal.status = form.cleaned_data["status"]
328330
proposal.proposal_type_id = form.cleaned_data["proposal_type"]
329331
proposal.proposal_section_id = form.cleaned_data["proposal_section"]

junction/templates/proposals/detail/base.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ <h1 class="proposal-title">
7979
</div>
8080
{% endif %}
8181

82+
{% if is_author or is_reviewer or user.is_superuser and proposal.is_first_time_speaker %}
83+
<span class="label label-info">First Time Speaker</span>
84+
{% endif %}
85+
8286
{% comment %}
8387
{% if is_reviewer %}
8488
<a class="tag label label-proposal-type" href="{{ proposal.get_review_url }}">Review proposal</a>

0 commit comments

Comments
 (0)