Skip to content

Commit

Permalink
community/: Add a form for adding a gsoc student
Browse files Browse the repository at this point in the history
Closes coala#273
  • Loading branch information
KVGarg committed Aug 2, 2019
1 parent 378e6f1 commit 0743317
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 1 deletion.
44 changes: 44 additions & 0 deletions community/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,47 @@ class OrganizationMentor(forms.Form):
choices=[('GSoC', 'Google Summer of Code'), ('GCI', 'Google Code-In')],
label='Mentoring Program'
)


class GSOCStudent(forms.Form):
user = forms.CharField(
max_length=50, label='GitHub Username',
widget=forms.TextInput(attrs={'autocomplete': 'off'})
)
year = forms.IntegerField(
label='Participation year',
widget=forms.NumberInput(attrs={'autocomplete': 'off'})
)
project_topic = forms.CharField(
max_length=300, label='GSoC Project Topic',
help_text='Should be same as on GSoC Website!',
widget=forms.TextInput(attrs={'autocomplete': 'off'})
)
project_desc = forms.CharField(
max_length=2000, label='Project Description',
widget=forms.Textarea(attrs={'autocomplete': 'off'})
)
accepted_proposal = forms.URLField(
label='Accepted Proposal URL',
help_text='The proposal you submitted during GSoC Program!',
widget=forms.URLInput(attrs={'autocomplete': 'off'})
)
cEP = forms.URLField(
label='Org Enhancement Proposal Merge Request', required=False,
help_text='For example, in {org} we have cEP({org} Enhancement '
'Proposal)'.format(org='coala'), # Ignore KeywordBear
widget=forms.URLInput(attrs={'autocomplete': 'off'})
)
project_url = forms.URLField(
label='GSoC Project URL',
widget=forms.URLInput(attrs={'autocomplete': 'off'})
)
mentors = forms.CharField(
max_length=200, label='Project Mentors',
help_text='Separate name of mentor by comma(,)',
widget=forms.TextInput(attrs={'autocomplete': 'off'})
)
image = forms.URLField(
label='Personal Image URL', required=False,
widget=forms.URLInput(attrs={'autocomplete': 'off'})
)
12 changes: 11 additions & 1 deletion community/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
JoinCommunityForm,
CommunityGoogleForm,
CommunityEvent,
OrganizationMentor
OrganizationMentor,
GSOCStudent,
)
from data.models import Team
from gamification.models import Participant as GamificationParticipant
Expand Down Expand Up @@ -47,6 +48,14 @@ def initialize_org_context_details():
return org_details


def get_gsoc_student_form_variables(context):
context['gsoc_student_form'] = GSOCStudent()
context['gsoc_student_form_name'] = os.environ.get(
'GSOC_STUDENT_FORM_NAME', None
)
return context


def get_community_mentor_form_variables(context):
context['organization_mentor_form'] = OrganizationMentor()
context['organization_mentor_form_name'] = os.environ.get(
Expand Down Expand Up @@ -75,6 +84,7 @@ def get_all_community_forms(context):
context = get_community_google_form_variables(context)
context = get_community_event_form_variables(context)
context = get_community_mentor_form_variables(context)
context = get_gsoc_student_form_variables(context)
return context


Expand Down
54 changes: 54 additions & 0 deletions templates/community_forms.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,57 @@ <h5 class="text-center custom-green-color-font bold-text">
<input class="waves-effect waves-light btn-large large-font" type="submit" value="Submit">
</div>
</form>

<form name="{{ gsoc_student_form_name }}" method="post"
netlify-honeypot="bot-field" class="participated-in-gsoc-form display-none"
data-netlify="true" action="/">
<h5 class="text-center custom-green-color-font bold-text">
Google Summer of Code, Participation Student Details
</h5>
{% csrf_token %}
{% for field in gsoc_student_form %}
<div class="row">
<div class="input-field col s12">
{% if field.name == 'user' %}
<p><label for="{{ field.name }}">{{ field.label }}</label></p>
{% else %}
<label for="{{ field.name }}">{{ field.label }}</label>
{% endif %}
{{ field }}
{% if field.help_text %}
<i class="fa fa-info-circle" aria-hidden="true">{{ field.help_text }}</i>
{% endif %}
</div>
</div>
{% endfor %}
<div class="validation-checkboxes">
<p>
<label>
<input type="checkbox" required>
<span>I am a member of {{ org.name }} oragnization.</span>
</label>
</p>
<p>
<label>
<input type="checkbox" required>
<span>All of the above information provided by me has no false
entries. If so, I am liable of getting blacklisted.</span>
</label>
</p>
<p style="display: none">
<label>
<input type="checkbox" name="bot-field">
<span>I am a bot</span>
</label>
</p>
<p>
<strong>
Note: You will receive an email within 24 hrs, if any of the
validation checks are not passed.
</strong>
</p>
</div>
<div class="apply-flex center-content submit-btn">
<input class="waves-effect waves-light btn-large large-font" type="submit" value="Submit">
</div>
</form>

0 comments on commit 0743317

Please sign in to comment.