diff --git a/community/forms.py b/community/forms.py index 25c28935..c3e00d39 100644 --- a/community/forms.py +++ b/community/forms.py @@ -1,5 +1,9 @@ +from datetime import datetime + from django import forms +TODAY = datetime.now().today() + class JoinCommunityForm(forms.Form): @@ -129,3 +133,18 @@ class CommunityEvent(forms.Form): help_text='DateTime Format should be YYYY-MM-DD HH:MM:SS', widget=forms.TextInput(attrs={'autocomplete': 'off'}) ) + + +class OrganizationMentor(forms.Form): + user = forms.CharField( + max_length=50, label='GitHub Username', + widget=forms.TextInput(attrs={'autocomplete': 'off'}) + ) + year = forms.ChoiceField( + choices=[(TODAY.year, TODAY.year),(TODAY.year + 1, TODAY.year + 1)], + label='Mentoring Year', widget=forms.Select() + ) + program = forms.ChoiceField( + choices=[('GSoC', 'Google Summer of Code'), ('GCI', 'Google Code-In')], + label='Mentoring Program' + ) diff --git a/community/views.py b/community/views.py index a3e2ce67..b27318a8 100644 --- a/community/views.py +++ b/community/views.py @@ -12,7 +12,12 @@ get_org_name, get_remote_url ) -from .forms import JoinCommunityForm, CommunityGoogleForm, CommunityEvent +from .forms import ( + JoinCommunityForm, + CommunityGoogleForm, + CommunityEvent, + OrganizationMentor +) from data.models import Team from gamification.models import Participant as GamificationParticipant from meta_review.models import Participant as MetaReviewer @@ -42,6 +47,14 @@ def initialize_org_context_details(): return org_details +def get_community_mentor_form_variables(context): + context['organization_mentor_form'] = OrganizationMentor() + context['organization_mentor_form_name'] = os.environ.get( + 'MENTOR_FORM_NAME', None + ) + return context + + def get_community_event_form_variables(context): context['community_event_form'] = CommunityEvent() context['community_event_form_name'] = os.environ.get( @@ -58,12 +71,18 @@ def get_community_google_form_variables(context): return context +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) + return context + + def get_header_and_footer(context): context['isTravis'] = Travis.TRAVIS context['travisLink'] = Travis.TRAVIS_BUILD_WEB_URL context['org'] = initialize_org_context_details() - context = get_community_google_form_variables(context) - context = get_community_event_form_variables(context) + context = get_all_community_forms(context) print('Running on Travis: {}, build link: {}'.format(context['isTravis'], context['travisLink'] )) diff --git a/templates/community_forms.html b/templates/community_forms.html index a8b31d28..9a18efab 100644 --- a/templates/community_forms.html +++ b/templates/community_forms.html @@ -105,3 +105,53 @@
+ +