Skip to content

Commit

Permalink
Add First Time Speaker field in create proposal page
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
abhishekmishragithub committed Jul 7, 2020
1 parent dd5ec2c commit 1d4d93d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
7 changes: 7 additions & 0 deletions junction/proposals/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ class ProposalForm(forms.Form):
help_text="Links to your previous work like Blog, Open Source Contributions etc ...",
)

is_first_time_speaker = forms.BooleanField(
label="First Time Speaker",
required=False,
help_text="Please tick, if you are a first time speaker"
)

def __init__(self, conference, action="edit", *args, **kwargs):
super(ProposalForm, self).__init__(*args, **kwargs)
self.fields["proposal_section"].choices = _get_proposal_section_choices(
Expand All @@ -165,6 +171,7 @@ def populate_form_for_update(self, proposal):
"content_urls": proposal.content_urls,
"speaker_info": proposal.speaker_info,
"speaker_links": proposal.speaker_links,
"is_first_time_speaker": proposal.is_first_time_speaker,
"status": proposal.status,
"proposal_section": proposal.proposal_section.pk,
"proposal_type": proposal.proposal_type.pk,
Expand Down
25 changes: 25 additions & 0 deletions junction/proposals/migrations/0029_auto_20200707_0844.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2020-07-07 03:14
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('proposals', '0028_auto_20200617_2337'),
]

operations = [
migrations.AddField(
model_name='historicalproposal',
name='is_first_time_speaker',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='proposal',
name='is_first_time_speaker',
field=models.BooleanField(default=False),
),
]
1 change: 1 addition & 0 deletions junction/proposals/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class Proposal(TimeAuditModel):
content_urls = models.TextField(blank=True, default="")
speaker_info = models.TextField(blank=True, default="")
speaker_links = models.TextField(blank=True, default="")
is_first_time_speaker = models.BooleanField(blank=True, default=False)
status = models.PositiveSmallIntegerField(
choices=ProposalStatus.CHOICES, default=ProposalStatus.DRAFT
)
Expand Down
2 changes: 2 additions & 0 deletions junction/proposals/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def create_proposal(request, conference_slug):
content_urls=form.cleaned_data["content_urls"],
speaker_info=form.cleaned_data["speaker_info"],
speaker_links=form.cleaned_data["speaker_links"],
is_first_time_speaker=form.cleaned_data["is_first_time_speaker"],
status=form.cleaned_data["status"],
proposal_type_id=form.cleaned_data["proposal_type"],
proposal_section_id=form.cleaned_data["proposal_section"],
Expand Down Expand Up @@ -324,6 +325,7 @@ def update_proposal(request, conference_slug, slug):
proposal.content_urls = form.cleaned_data["content_urls"]
proposal.speaker_info = form.cleaned_data["speaker_info"]
proposal.speaker_links = form.cleaned_data["speaker_links"]
proposal.is_first_time_speaker = form.cleaned_data["is_first_time_speaker"]
proposal.status = form.cleaned_data["status"]
proposal.proposal_type_id = form.cleaned_data["proposal_type"]
proposal.proposal_section_id = form.cleaned_data["proposal_section"]
Expand Down
7 changes: 7 additions & 0 deletions junction/templates/proposals/detail/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ <h4 class='heading'><b>Speaker Links:</b></h4>
</div>
{% endif %}

{% if proposal.is_first_time_speaker %}
<div class="proposal-writeup--section">
<h4 class='heading'><b>First Time Speaker:</b></h4>
<p> Yes</p>
</div>
{% endif %}

{% if is_section_reviewer or user.is_authenticated and user.is_superuser %}
<div class="proposal-writeup--section">
<h4 class='heading'><b>Reviewer Actions:</b></h4>
Expand Down

0 comments on commit 1d4d93d

Please sign in to comment.