Skip to content

Commit

Permalink
Application form - All tentative changes (#14)
Browse files Browse the repository at this point in the history
* test changes

* deleted migration file

* added new pronoun choices, reformatted error checking

* black format changes

* reverting landing.html changes

* added gender field

* removed ethnicity

* added tshirt size

* added dietary restriction, made ethnicity changes

* black changes

* black.... again?

* attempting to fix black problems

* deleting dummy comment

* i hope this black fix works

* added under-represented group question

* added sexual identity:

* added highest former education

* fixed typo

* reduced options for curr education

* added how many hackathons field

* black changes

* added new hackathon question, modified ethnicity field

* modified technical experience question

* changed what past experience field

* added team role question

* added discover method, made word count bigger for personal info

* removed comments

* more comment deletion

* removing more comments

* remove comments

* remove comments

* removed ethnicity comment
  • Loading branch information
carmen-chau authored Sep 26, 2024
1 parent bc52375 commit 76c0399
Show file tree
Hide file tree
Showing 5 changed files with 665 additions and 28 deletions.
2 changes: 1 addition & 1 deletion hackathon_site/event/jinja2/event/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -414,4 +414,4 @@ <h3 class="row center">Contact Us</h3>

{% block scripts %}
<script src="{{ static('event/js/landing.js') }}"></script>
{% endblock %}
{% endblock %}
129 changes: 124 additions & 5 deletions hackathon_site/registration/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,21 @@ class Meta:
fields = [
"age",
"pronouns",
"ethnicity",
"free_response_pronouns",
"gender",
"free_response_gender",
# "ethnicity",
"phone_number",
"city",
"country",
"tshirt_size",
"dietary_restrictions",
"free_response_dietary_restrictions",
"under_represented_group",
"sexual_identity",
"free_response_sexual_identity",
"highest_formal_education",
"free_response_highest_formal_education",
"school",
"study_level",
"graduation_year",
Expand All @@ -134,9 +145,13 @@ class Meta:
"linkedin",
"github",
"devpost",
"how_many_hackathons",
"past_hackathon_info",
"what_past_experience",
"why_participate",
"what_technical_experience",
"what_past_experience",
"what_role_in_team_setting",
"discovery_method",
"conduct_agree",
"logistics_agree",
"email_agree",
Expand All @@ -149,6 +164,36 @@ class Meta:
choices=((None, ""),),
),
"resume": MaterialFileInput(),
"free_response_pronouns": forms.Textarea(
attrs={"class": "materialize-textarea", "data-length": 200}
),
"free_response_gender": forms.Textarea(
attrs={"class": "materialize-textarea", "data-length": 200}
),
"free_response_sexual_identity": forms.Textarea(
attrs={"class": "materialize-textarea", "data-length": 200}
),
"free_response_dietary_restrictions": forms.Textarea(
attrs={"class": "materialize-textarea", "data-length": 200}
),
"free_response_highest_formal_education": forms.Textarea(
attrs={"class": "materialize-textarea", "data-length": 200}
),
"past_hackathon_info": forms.Textarea(
attrs={
"class": "materialize-textarea",
"placeholder": "Insert past hackathon description here...",
"data-length": 1000,
}
),
"what_past_experience": forms.Textarea(
attrs={
"class": "materialize-textarea",
"placeholder": "Insert answer here...",
"data-length": 1000,
"style": "padding-top: 38px;",
}
),
"why_participate": forms.Textarea(
attrs={
"class": "materialize-textarea",
Expand All @@ -159,14 +204,14 @@ class Meta:
"what_technical_experience": forms.Textarea(
attrs={
"class": "materialize-textarea",
"placeholder": "My technical experience with software are...",
"placeholder": "My technical experience with software and hardware are...",
"data-length": 1000,
}
),
"what_past_experience": forms.Textarea(
"what_role_in_team_setting": forms.Textarea(
attrs={
"class": "materialize-textarea",
"placeholder": "My past experiences are...",
"placeholder": "I take on the role of...",
"data-length": 1000,
}
),
Expand All @@ -192,6 +237,12 @@ def clean(self):
raise forms.ValidationError(
_("User has already submitted an application."), code="invalid"
)
self.clean_age()
self.handle_free_response_pronouns()
self.handle_free_response_gender()
self.handle_free_response_sexual_identity()
self.handle_free_response_dietary_restrictions()
self.handle_highest_formal_education()
return cleaned_data

def clean_age(self):
Expand All @@ -206,6 +257,74 @@ def clean_age(self):
)
return user_age

def handle_free_response_pronouns(self):
user_pronouns = self.cleaned_data["pronouns"]
user_free_response_pronouns = self.cleaned_data["free_response_pronouns"]
if user_pronouns == "other" and not user_free_response_pronouns:
raise forms.ValidationError(
_(
"Since you've selected 'Other' for pronouns, please state what pronouns you go by."
),
code="free_response_pronouns",
)

def handle_free_response_gender(self):
user_gender = self.cleaned_data["gender"]
user_free_response_gender = self.cleaned_data["free_response_gender"]
if user_gender == "prefer-to-self-describe" and not user_free_response_gender:
raise forms.ValidationError(
_(
"Since you've selected 'Prefer to Self Describe' for gender, please state how you would like to be addressed"
),
code="free_response_gender",
)

def handle_free_response_dietary_restrictions(self):
user_dietary_restrictions = self.cleaned_data["dietary_restrictions"]
user_free_response_dietary_restrictions = self.cleaned_data[
"free_response_dietary_restrictions"
]
if (
user_dietary_restrictions == "allergies"
or user_dietary_restrictions == "other"
) and not user_free_response_dietary_restrictions:
raise forms.ValidationError(
_("Please provide more information about your dietary restrictions."),
code="free_response_dietary_restrictions",
)

def handle_free_response_sexual_identity(self):
user_sexual_identity = self.cleaned_data["sexual_identity"]
user_free_response_sexual_identity = self.cleaned_data[
"free_response_sexual_identity"
]
if (
user_sexual_identity == "different-identity"
and not user_free_response_sexual_identity
):
raise forms.ValidationError(
_(
"You've selected 'Different Identity', please state how you would like to identify yourself"
),
code="free_response_sexual_identity",
)

def handle_highest_formal_education(self):
user_highest_formal_education = self.cleaned_data["highest_formal_education"]
user_free_response_highest_formal_education = self.cleaned_data[
"free_response_highest_formal_education"
]
if (
user_highest_formal_education == "other"
and not user_free_response_highest_formal_education
):
raise forms.ValidationError(
_(
"You've selected 'Other' for highest formal education, please elaborate in the corresponding field."
),
code="free_response_highest_formal_education",
)

def save(self, commit=True):
self.instance = super().save(commit=False)
team = Team.objects.create()
Expand Down
29 changes: 23 additions & 6 deletions hackathon_site/registration/jinja2/registration/application.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,26 @@ <h4>Personal Information</h4>
{{ render_field(form.age, size="s12 m6 select2-wrapper") }}
{{ render_field(form.phone_number, size="s12 m6") }}
{{ render_field(form.pronouns, size="s12 m6 select2-wrapper") }}
{{ render_field(form.ethnicity, size="s12 m6 select2-wrapper") }}
{{ render_field(form.free_response_pronouns, show_help_text_as_label=True, size="s12 m6 select2-wrapper") }}
{{ render_field(form.gender, size="s12 m6 select2-wrapper") }}
{{ render_field(form.free_response_gender, show_help_text_as_label=True, size="s12 m6 select2-wrapper") }}
{{ render_field(form.sexual_identity, show_help_text_as_label=True, size="s12 m6 select2-wrapper") }}
{{ render_field(form.free_response_sexual_identity, show_help_text_as_label=True, size="s12 m6 select2-wrapper") }}
{# {{ render_field(form.ethnicity, size="s12 m6 select2-wrapper") }}#}
{{ render_field(form.city, size="s12 m6 select2-wrapper added-country-margin formAddTopMargin") }}
{{ render_field(form.country, size="s12 m6 select2-wrapper added-country-margin formAddTopMargin") }}
{{ render_field(form.tshirt_size, size="s12 m6 select2-wrapper") }}
{{ render_field(form.under_represented_group, show_help_text_as_label=True, size="s12 m6 select2-wrapper") }}
{{ render_field(form.dietary_restrictions, size="s12 m6 select2-wrapper") }}
{{ render_field(form.free_response_dietary_restrictions, show_help_text_as_label=True, size="s12 m6 select2-wrapper") }}
{{ render_field(form.highest_formal_education, show_help_text_as_label=True, size="s12 m6 select2-wrapper") }}
{{ render_field(form.free_response_highest_formal_education, show_help_text_as_label=True, size="s12 m6 select2-wrapper") }}

<div class="col s12">
<h4>Education</h4>
</div>
{{ render_field(form.school, size="s12 m6 select2-wrapper") }}
{{ render_field(form.study_level, size="s12 m6 select2-wrapper") }}
{{ render_field(form.study_level, show_help_text_as_label=True, size="s12 m6 select2-wrapper") }}
{{ render_field(form.graduation_year, size="s12 m6 select2-wrapper") }}
{{ render_field(form.program, size="s12 m6 select2-wrapper", show_help_text_as_label=True) }}

Expand All @@ -61,9 +72,13 @@ <h4>Online Profiles</h4>
<div class="col s12">
<h4>Questions</h4>
</div>
{{ render_field(form.how_many_hackathons, show_help_text_as_label=True, size="s12 select2-wrapper") }}
{{ render_field(form.past_hackathon_info, show_help_text_as_label=True) }}
{{ render_field(form.what_past_experience, show_help_text_as_label=True) }}
{{ render_field(form.why_participate, show_help_text_as_label=True) }}
{{ render_field(form.what_technical_experience, show_help_text_as_label=True) }}
{{ render_field(form.what_past_experience, show_help_text_as_label=True) }}
{{ render_field(form.what_role_in_team_setting, show_help_text_as_label=True) }}
{{ render_field(form.discovery_method, show_help_text_as_label=True, size="s12 select2-wrapper") }}

<div class="col s12">
<p>We are currently in the process of partnering with MLH. The following 3 checkboxes are for this partnership. If we do not end up partnering with MLH, your information will not be shared.</p>
Expand All @@ -78,10 +93,11 @@ <h4>Questions</h4>

{% block form_button %}
<div class="input-field col s12 center" style="margin-bottom: 0">
<p>You cannot edit this afterwards!</p>
<p>Please note: After submission, you will no longer be able to edit your answers!</p>
<br/>
<p>At present, this submission is intended for preregistration. Rest assured, we will notify you via email as soon as official registration becomes available.
</p>
<p>For the long answer questions, we recommended writing your answer in a separate document first, then pasting it into the form.</p>
{# <p>At present, this submission is intended for preregistration. Rest assured, we will notify you via email as soon as official registration becomes available.#}
{# </p>#}
<br/>
<button type="submit" class="btn-small waves-effect waves-light colorBtn">Submit</button>
</div>
Expand Down Expand Up @@ -127,6 +143,7 @@ <h4>Questions</h4>
e.stopPropagation();
});
});
$("#id_free_response_pronouns, #id_free_response_gender, #id_free_response_sexual_identity, #id_free_response_dietary_restrictions, #id_free_response_highest_formal_education, #id_what_role_in_team_setting, #id_past_hackathon_info, #id_what_hackathon_experience, #id_why_participate, #id_what_technical_experience").characterCounter(); // TODO: TEMPORARY LINE

// on first focus (bubbles up to document), open the menu
// https://stackoverflow.com/a/49261426/3882202
Expand Down
Loading

0 comments on commit 76c0399

Please sign in to comment.