Skip to content

Commit 85ec1e3

Browse files
committed
community/: Add a form for adding a gsoc student
Closes #273
1 parent 03622fa commit 85ec1e3

File tree

3 files changed

+109
-1
lines changed

3 files changed

+109
-1
lines changed

community/forms.py

+44
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,47 @@ class OrganizationMentor(forms.Form):
148148
choices=[('GSoC', 'Google Summer of Code'), ('GCI', 'Google Code-In')],
149149
label='Mentoring Program'
150150
)
151+
152+
153+
class GSOCStudent(forms.Form):
154+
user = forms.CharField(
155+
max_length=50, label='GitHub Username',
156+
widget=forms.TextInput(attrs={'autocomplete': 'off'})
157+
)
158+
year = forms.IntegerField(
159+
label='Participation year',
160+
widget=forms.NumberInput(attrs={'autocomplete': 'off'})
161+
)
162+
project_topic = forms.CharField(
163+
max_length=300, label='GSoC Project Topic',
164+
help_text='Should be same as on GSoC Website!',
165+
widget=forms.TextInput(attrs={'autocomplete': 'off'})
166+
)
167+
project_desc = forms.CharField(
168+
max_length=2000, label='Project Description',
169+
widget=forms.Textarea(attrs={'autocomplete': 'off'})
170+
)
171+
accepted_proposal = forms.URLField(
172+
label='Accepted Proposal URL',
173+
help_text='The proposal you submitted during GSoC Program!',
174+
widget=forms.URLInput(attrs={'autocomplete': 'off'})
175+
)
176+
cEP = forms.URLField(
177+
label='Org Enhancement Proposal Merge Request', required=False,
178+
help_text='For example, in {org} we have cEP({org} Enhancement '
179+
'Proposal)'.format(org='coala'), # Ignore KeywordBear
180+
widget=forms.URLInput(attrs={'autocomplete': 'off'})
181+
)
182+
project_url = forms.URLField(
183+
label='GSoC Project URL',
184+
widget=forms.URLInput(attrs={'autocomplete': 'off'})
185+
)
186+
mentors = forms.CharField(
187+
max_length=200, label='Project Mentors',
188+
help_text='Separate name of mentor by comma(,)',
189+
widget=forms.TextInput(attrs={'autocomplete': 'off'})
190+
)
191+
image = forms.URLField(
192+
label='Personal Image URL', required=False,
193+
widget=forms.URLInput(attrs={'autocomplete': 'off'})
194+
)

community/views.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
JoinCommunityForm,
1717
CommunityGoogleForm,
1818
CommunityEvent,
19-
OrganizationMentor
19+
OrganizationMentor,
20+
GSOCStudent,
2021
)
2122
from data.models import Team
2223
from gamification.models import Participant as GamificationParticipant
@@ -47,6 +48,14 @@ def initialize_org_context_details():
4748
return org_details
4849

4950

51+
def get_gsoc_student_form_variables(context):
52+
context['gsoc_student_form'] = GSOCStudent()
53+
context['gsoc_student_form_name'] = os.environ.get(
54+
'GSOC_STUDENT_FORM_NAME', None
55+
)
56+
return context
57+
58+
5059
def get_community_mentor_form_variables(context):
5160
context['organization_mentor_form'] = OrganizationMentor()
5261
context['organization_mentor_form_name'] = os.environ.get(
@@ -75,6 +84,7 @@ def get_all_community_forms(context):
7584
context = get_community_google_form_variables(context)
7685
context = get_community_event_form_variables(context)
7786
context = get_community_mentor_form_variables(context)
87+
context = get_gsoc_student_form_variables(context)
7888
return context
7989

8090

templates/community_forms.html

+54
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,57 @@ <h5 class="text-center custom-green-color-font bold-text">
206206
<input class="waves-effect waves-light btn-large large-font" type="submit" value="Submit">
207207
</div>
208208
</form>
209+
210+
<form name="{{ gsoc_student_form_name }}" method="post"
211+
netlify-honeypot="bot-field" class="participated-in-gsoc-form display-none"
212+
data-netlify="true" action="/">
213+
<h5 class="text-center custom-green-color-font bold-text">
214+
Google Summer of Code, Participation Student Details
215+
</h5>
216+
{% csrf_token %}
217+
{% for field in gsoc_student_form %}
218+
<div class="row">
219+
<div class="input-field col s12">
220+
{% if field.name == 'user' %}
221+
<p>{{ field.label_tag }}</p>
222+
{% else %}
223+
{{ field.label_tag }}
224+
{% endif %}
225+
{{ field }}
226+
{% if field.help_text %}
227+
<i class="fa fa-info-circle" aria-hidden="true">{{ field.help_text }}</i>
228+
{% endif %}
229+
</div>
230+
</div>
231+
{% endfor %}
232+
<div class="validation-checkboxes">
233+
<p>
234+
<label>
235+
<input type="checkbox" required>
236+
<span>I am a member of {{ org.name }} oragnization.</span>
237+
</label>
238+
</p>
239+
<p>
240+
<label>
241+
<input type="checkbox" required>
242+
<span>All of the above information provided by me has no false
243+
entries. If so, I am liable of getting blacklisted.</span>
244+
</label>
245+
</p>
246+
<p style="display: none">
247+
<label>
248+
<input type="checkbox" name="bot-field">
249+
<span>I am a bot</span>
250+
</label>
251+
</p>
252+
<p>
253+
<strong>
254+
Note: You will receive an email within 24 hrs, if any of the
255+
validation checks are not passed.
256+
</strong>
257+
</p>
258+
</div>
259+
<div class="apply-flex center-content submit-btn">
260+
<input class="waves-effect waves-light btn-large large-font" type="submit" value="Submit">
261+
</div>
262+
</form>

0 commit comments

Comments
 (0)