Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
{% if not h_discord %}
{% include 'include/judging_tab.html' %}
{% include 'include/judging_tab.html' %}
{% endif %}
{% if request.user.is_authenticated and cas != 'True' %}
{% include 'include/admin_tab.html' %}
Expand Down Expand Up @@ -132,7 +132,7 @@
{% endif %}
{% endif %}
{% elif cas != 'True' %}
{% include 'include/judging_tab.html' %}
{% include 'include/judging_tab.html' %}
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
Expand Down
1 change: 1 addition & 0 deletions app/templates/base_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
{% bootstrap_form filter.form %}
{% endif %}
<button type="submit" class="btn btn-info">Filter</button>
<a href="?" class="btn btn-danger">Clear Filters</a>
</form>
{% endif %}
{% block extra_panel %}
Expand Down
16 changes: 6 additions & 10 deletions applications/forms/hacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class HackerApplicationForm(_BaseApplicationForm):
{"name": "degree", "space": 12},
{"name": "graduation_year", "space": 12},
],
"description": "Hey there, before we begin, as a student hackathon, we need some information on your education background.",
"description": "Hey there! Before we begin, as a student hackathon we need some information on your education background.",
},
"👤 Personal Info": {
"fields": [
Expand Down Expand Up @@ -138,19 +138,15 @@ def clean_kind_studies(self):
raise forms.ValidationError("Please select your current studies.")
return data


first_timer = common_first_timer()

kind_studies = forms.ChoiceField(
required=True,
label='What kind of studies are you currently pursuing?',
choices=([('', '- Select an option -')] + models.constants.KIND_STUDIES),
widget=forms.Select(
attrs={'class': 'form-control'}
)
label="What kind of studies are you currently pursuing?",
choices=([("", "- Select an option -")] + models.constants.KIND_STUDIES),
widget=forms.Select(attrs={"class": "form-control"}),
)


university = common_university()

degree = common_degree()
Expand Down Expand Up @@ -255,7 +251,7 @@ class Meta(_BaseApplicationForm.Meta):
help_texts = {
"gender": "This is for demographic purposes. You can skip this question if you want.",
"degree": "What's your major/degree?",
"other_diet": "Please fill here in your dietary requirements. We want to make sure we have food for you!",
"other_diet": "Please note that the logistics team needs this information to ensure we can do our best to accommodate everyone’s needs. However, if dietary requirements are not clearly justified or specified in advance, it may be impossible for us to provide the appropriate options.",
"lennyface": 'tip: you can chose from here <a href="http://textsmili.es/" target="_blank">'
" http://textsmili.es/</a>",
"description": "<span id='description_char_count'></span><br>"
Expand Down
24 changes: 12 additions & 12 deletions applications/forms/mentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

class MentorApplicationForm(_BaseApplicationForm):
first_timer = common_first_timer()
#university = common_university()
# university = common_university()
degree = forms.CharField(
required=False,
max_length= 70,
max_length=70,
label="What's your major/degree?",
help_text="Current or most recent degree you've received",
widget=forms.TextInput(
attrs={"class": "typeahead-degrees", "autocomplete": "off"}
),
)
#Mandatory social fields
# Mandatory social fields
linkedin = social_required("linkedin", "https://www.linkedin.com/in/john_biene")

# Socials
Expand Down Expand Up @@ -105,9 +105,9 @@ def clean_projects(self):
label="What is your current role or most recent role?",
)

#university = forms.CharField(
# university = forms.CharField(
# initial="NA", widget=forms.HiddenInput(), required=False
#)
# )

graduation_year = forms.ChoiceField(
required=False,
Expand Down Expand Up @@ -136,7 +136,7 @@ def __init__(self, *args, **kwargs):
"fields": [
{"name": "study_work", "space": 12},
{"name": "company", "space": 12},
#{"name": "university", "space": 12},
# {"name": "university", "space": 12},
{"name": "degree", "space": 12},
{"name": "graduation_year", "space": 12},
{"name": "english_level", "space": 12},
Expand Down Expand Up @@ -223,7 +223,7 @@ def clean(self):
self.add_error("which_hack", "Choose the hackathons you mentored")
study = self.cleaned_data["study_work"]
if study:
#if not self.cleaned_data["university"]:
# if not self.cleaned_data["university"]:
# self.add_error("university", "Type your university, please")
if not self.cleaned_data["degree"]:
self.add_error("degree", "Type your degree, please")
Expand All @@ -243,18 +243,18 @@ class Meta(_BaseApplicationForm.Meta):
help_texts = {
"gender": "This is for demographic purposes.",
# 'degree': 'What\'s your major/degree?',
"other_diet": "Please fill here in your dietary requirements. We want to make sure we have food for you!",
"other_diet": "Please note that the logistics team needs this information to ensure we can do our best to accommodate everyone’s needs. However, if dietary requirements are not clearly justified or specified in advance, it may be impossible for us to provide the appropriate options.",
"lennyface": 'tip: you can chose from here <a href="http://textsmili.es/" target="_blank">'
" http://textsmili.es/</a>",
"participated": "<span id=\'participated_char_count\'></span><br>"
"participated": "<span id='participated_char_count'></span><br>"
"You can talk about about past hackathons or any other events. ",
"resume": "Accepted file formats: %s"
% (", ".join(extensions) if extensions else "Any"),
"fluent": "<span id=\'fluent_char_count\'></span><br>"
"fluent": "<span id='fluent_char_count'></span><br>"
"Catalan, French, Chinese, Arabic…",
"experience": "<span id=\'experience_char_count\'></span><br>"
"experience": "<span id='experience_char_count'></span><br>"
"C++, Java, Docker, Vue, AWS…",
"why_mentor": "<span id=\'why_mentor_char_count\'></span><br>"
"why_mentor": "<span id='why_mentor_char_count'></span><br>",
}

widgets = {
Expand Down
117 changes: 71 additions & 46 deletions applications/forms/sponsor.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,45 @@
from .base import *


class SponsorForm(OverwriteOnlyModelFormMixin, BootstrapFormMixin, ModelForm):
diet = forms.ChoiceField(required=True, choices=models.DIETS)
tshirt_size = forms.ChoiceField(required=False, choices=models.TSHIRT_SIZES)
phone_number = forms.CharField(required=False, widget=forms.TextInput(
attrs={'class': 'form-control', 'placeholder': '+#########'}))
phone_number = forms.CharField(
required=False,
widget=forms.TextInput(
attrs={"class": "form-control", "placeholder": "+#########"}
),
)
terms_and_conditions = forms.BooleanField(
required=False,
label='I\'ve read, understand and accept <a href="/terms_and_conditions" target="_blank">%s '
'Terms & Conditions</a> and <a href="/privacy_and_cookies" target="_blank">%s '
'Privacy and Cookies Policy</a>.<span style="color: red; font-weight: bold;"> *</span>' % (
settings.HACKATHON_NAME, settings.HACKATHON_NAME
)
'Terms & Conditions</a> and <a href="/privacy_and_cookies" target="_blank">%s '
'Privacy and Cookies Policy</a>.<span style="color: red; font-weight: bold;"> *</span>'
% (settings.HACKATHON_NAME, settings.HACKATHON_NAME),
)

diet_notice = forms.BooleanField(
required=False,
label='I authorize "Hackers at UPC" to use my food allergies and intolerances information to '
'manage the catering service only.<span style="color: red; font-weight: bold;"> *</span>'
'manage the catering service only.<span style="color: red; font-weight: bold;"> *</span>',
)

bootstrap_field_info = {
'Personal Info': {
'fields': [{'name': 'name', 'space': 12}, {'name': 'email', 'space': 12},
{'name': 'phone_number', 'space': 12},
{'name': 'tshirt_size', 'space': 12}, {'name': 'position', 'space': 12},
{'name': 'attendance', 'space': 12}],
'description': 'Hey there, before we begin we would like to know a little more about you.'
"Personal Info": {
"fields": [
{"name": "name", "space": 12},
{"name": "email", "space": 12},
{"name": "phone_number", "space": 12},
{"name": "tshirt_size", "space": 12},
{"name": "position", "space": 12},
{"name": "attendance", "space": 12},
],
"description": "Hey there, before we begin we would like to know a little more about you.",
},
}

def clean_terms_and_conditions(self):
cc = self.cleaned_data.get('terms_and_conditions', False)
cc = self.cleaned_data.get("terms_and_conditions", False)
# Check that if it's the first submission hackers checks terms and conditions checkbox
# self.instance.pk is None if there's no Application existing before
# https://stackoverflow.com/questions/9704067/test-if-django-modelform-has-instance
Expand All @@ -42,60 +51,76 @@ def clean_terms_and_conditions(self):
return cc

def clean_diet_notice(self):
diet = self.cleaned_data.get('diet', 'None')
diet_notice = self.cleaned_data.get('diet_notice', False)
diet = self.cleaned_data.get("diet", "None")
diet_notice = self.cleaned_data.get("diet_notice", False)
# Check that if it's the first submission hackers checks terms and conditions checkbox
# self.instance.pk is None if there's no Application existing before
# https://stackoverflow.com/questions/9704067/test-if-django-modelform-has-instance
if diet != 'None' and not diet_notice and not self.instance.pk:
if diet != "None" and not diet_notice and not self.instance.pk:
raise forms.ValidationError(
"In order to apply and attend you have to accept us to use your personal data related to your food "
"allergies and intolerances only in order to manage the catering service."
)
return diet_notice

def clean_other_diet(self):
data = self.cleaned_data.get('other_diet', '')
diet = self.cleaned_data.get('diet', 'None')
if diet == 'Others' and not data:
raise forms.ValidationError("Please tell us your specific dietary requirements")
data = self.cleaned_data.get("other_diet", "")
diet = self.cleaned_data.get("diet", "None")
if diet == "Others" and not data:
raise forms.ValidationError(
"Please tell us your specific dietary requirements"
)
return data

def get_bootstrap_field_info(self):
fields = super().get_bootstrap_field_info()
discord = getattr(settings, 'DISCORD_HACKATHON', False)
personal_info_fields = fields['Personal Info']['fields']
polices_fields = [{'name': 'terms_and_conditions', 'space': 12}, ]
discord = getattr(settings, "DISCORD_HACKATHON", False)
personal_info_fields = fields["Personal Info"]["fields"]
polices_fields = [
{"name": "terms_and_conditions", "space": 12},
]
if not discord:
personal_info_fields.extend([{'name': 'diet', 'space': 12}, {'name': 'other_diet', 'space': 12}, ])
polices_fields.append({'name': 'diet_notice', 'space': 12})
personal_info_fields.extend(
[
{"name": "diet", "space": 12},
{"name": "other_diet", "space": 12},
]
)
polices_fields.append({"name": "diet_notice", "space": 12})
# Fields that we only need the first time the hacker fills the application
# https://stackoverflow.com/questions/9704067/test-if-django-modelform-has-instance
fields['HackUPC Policies'] = {
'fields': polices_fields,
'description': '<p style="color: margin-top: 1em;display: block;'
'margin-bottom: 1em;line-height: 1.25em;">We, Hackers at UPC, '
'process your information to organize an awesome hackathon. It '
'will also include images and videos of yourself during the event. '
'Your data will be used for admissions mainly. We may also reach '
'out to you (sending you an e-mail) about other events that we are '
'organizing and that are of a similar nature to those previously '
'requested by you. For more information on the processing of your '
'personal data and on how to exercise your rights of access, '
'rectification, suppression, limitation, portability and opposition '
'please visit our Privacy and Cookies Policy.</p>'}
fields["HackUPC Policies"] = {
"fields": polices_fields,
"description": '<p style="color: margin-top: 1em;display: block;'
'margin-bottom: 1em;line-height: 1.25em;">We, Hackers at UPC, '
"process your information to organize an awesome hackathon. It "
"will also include images and videos of yourself during the event. "
"Your data will be used for admissions mainly. We may also reach "
"out to you (sending you an e-mail) about other events that we are "
"organizing and that are of a similar nature to those previously "
"requested by you. For more information on the processing of your "
"personal data and on how to exercise your rights of access, "
"rectification, suppression, limitation, portability and opposition "
"please visit our Privacy and Cookies Policy.</p>",
}
return fields

class Meta:
model = models.SponsorApplication
help_texts = {
'other_diet': 'Please fill here in your dietary requirements. We want to make sure we have food for you!',
'email': 'This is needed in order to invite you to our message service'
"other_diet": "Please note that the logistics team needs this information to ensure we can do our best to accommodate everyone’s needs. However, if dietary requirements are not clearly justified or specified in advance, it may be impossible for us to provide the appropriate options.",
"email": "This is needed in order to invite you to our message service",
}
labels = {
'tshirt_size': 'What\'s your t-shirt size?',
'diet': 'Dietary requirements',
'attendance': 'What availability will you have during the event?',
'position': 'What is your job position?',
"tshirt_size": "What's your t-shirt size?",
"diet": "Dietary requirements",
"attendance": "What availability will you have during the event?",
"position": "What is your job position?",
}
exclude = ['user', 'uuid', 'submission_date', 'status_update_date', 'status', ]
exclude = [
"user",
"uuid",
"submission_date",
"status_update_date",
"status",
]
Loading