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
8 changes: 5 additions & 3 deletions hackathon_site/event/jinja2/event/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@
<a href="{{ url("event:logout") }}" class="btn-small waves-effect waves-light colorBtn">Logout</a>
</li>
{% else %}
<li>
<a href="#interest" class="btn-small waves-effect waves-light colorBtn">Register Your Interest</a>
</li>
{% if is_registration_open() %}
<li>
<a href="{{ url('registration:signup') }}" class="btn-small waves-effect waves-light colorBtn">Apply</a>
</li>
{% endif %}
{% endif %}
{% endblock %}
</ul>
Expand Down
9 changes: 6 additions & 3 deletions hackathon_site/event/jinja2/event/form_base.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{% extends "event/base.html" %}

{% macro render_field(field, show_help_text=False, show_label=True, show_help_text_as_label=False, size="s12", id="") %}
<div class="input-field row col {{ size }}" id="{{ id }}">
{% macro render_field(field, show_help_text=False, show_label=True, show_help_text_as_label=False, size="s12", id="", label_above=False) %}
<div class="input-field row col {{ size }}{% if label_above %} static-label{% endif %}" id="{{ id }}">
{% if show_label and label_above %}
<label for="{{ field.id_for_label }}">{{ field.help_text|safe or field.label }}</label>
{% endif %}
{{ field }}
{% if show_label %}
{% if show_label and not label_above %}
{% if show_help_text_as_label %}
<label for="{{ field.id_for_label }}">{{ field.help_text|safe or field.label}}</label>
{% else %}
Expand Down
4 changes: 3 additions & 1 deletion hackathon_site/event/jinja2/event/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{% block head_extends %}
<script>
const registrationOpenDate = new Date("{{ localtime(registration_open_date)|strftime('%b %-d, %Y, %H:%M:%S') }}");
const registrationOpenDate = {% if registration_open_date is not none %}new Date("{{ localtime(registration_open_date)|strftime('%b %-d, %Y, %H:%M:%S') }}"){% else %}null{% endif %};
const registrationCloseDate = new Date("{{ localtime(registration_close_date)|strftime('%b %-d, %Y, %H:%M:%S') }}");
const eventStartDate = new Date("{{ localtime(event_start_date)|strftime('%b %-d, %Y, %H:%M:%S') }}");
</script>
Expand Down Expand Up @@ -102,6 +102,7 @@ <h5>
</div>
<br />

{% if not is_registration_open() %}
<div class="container colorScroll" data-background-color="#fff">
<div class="section scrollspy" id="interest">
{% set msgs = get_messages(request) %}
Expand Down Expand Up @@ -169,6 +170,7 @@ <h3 class="center interest-title">Register Your Interest</h3>
</div>
</div>
</div>
{% endif %}

<div class="container colorScroll" data-background-color="#fff">
<div class="section scrollspy" id="about">
Expand Down
31 changes: 31 additions & 0 deletions hackathon_site/event/migrations/0014_auto_20261123_1432.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 3.2.15 on 2026-11-23 19:32

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("event", "0013_fix_mlh_dev_link_text"),
]

operations = [
migrations.AlterField(
model_name="interestsubmission",
name="email_agree",
field=models.BooleanField(
blank=True,
default=False,
help_text="I authorize MLH and DEV to send me occasional emails about relevant events, career opportunities, and community announcements.",
null=True,
),
),
migrations.AlterField(
model_name="interestsubmission",
name="logistics_agree",
field=models.BooleanField(
default=False,
help_text='I authorize you to share my application/registration information with Major League Hacking for event administration, ranking, and administration (including the creation of linked accounts on MLH and <a href="https://dev.to" rel="noopener noreferrer" target="_blank">DEV</a>) in line with the <a href="https://github.com/MLH/mlh-policies/blob/main/privacy-policy.md" rel="noopener noreferrer" target="_blank">MLH Privacy Policy</a>. I further agree to the terms of both the <a href="https://github.com/MLH/mlh-policies/blob/main/contest-terms.md" rel="noopener noreferrer" target="_blank">MLH Contest Terms and Conditions</a> and the <a href="https://github.com/MLH/mlh-policies/blob/main/privacy-policy.md" rel="noopener noreferrer" target="_blank">MLH Privacy Policy</a>.',
),
),
]
6 changes: 3 additions & 3 deletions hackathon_site/event/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,17 +337,17 @@ class InterestSubmission(models.Model):
help_text="I authorize you to share my application/registration information with Major League Hacking"
" for event administration, ranking, and administration (including the creation of linked accounts on MLH and "
'<a href="https://dev.to" rel="noopener noreferrer" target="_blank">DEV</a>) in line with the '
"MLH Privacy Policy. "
'<a href="https://github.com/MLH/mlh-policies/blob/main/privacy-policy.md" rel="noopener noreferrer" target="_blank">MLH Privacy Policy</a>. '
"I further agree to the terms of both the "
'<a href="https://github.com/MLH/mlh-policies/blob/main/contest-terms.md" rel="noopener noreferrer" target="_blank">MLH Contest Terms and Conditions</a>'
" and the "
"MLH Privacy Policy.",
'<a href="https://github.com/MLH/mlh-policies/blob/main/privacy-policy.md" rel="noopener noreferrer" target="_blank">MLH Privacy Policy</a>.',
blank=False,
null=False,
default=False,
)
email_agree = models.BooleanField(
help_text="I authorize MLH + DEV to send me occasional emails about relevant events, career opportunities, and community announcements.",
help_text="I authorize MLH and DEV to send me occasional emails about relevant events, career opportunities, and community announcements.",
blank=True,
null=True,
default=False,
Expand Down
18 changes: 15 additions & 3 deletions hackathon_site/event/static/event/js/application.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
$(document).ready(function () {
$(
"#what_hackathon_experience, #id_why_participate, #id_what_technical_experience"
).characterCounter();
$("textarea[data-max-words]").each(function () {
const field = $(this);
const limit = Number(field.attr("data-max-words"));
const counter = $('<span class="helper-text" aria-live="polite"></span>');
field.parent().append(counter);

function updateCount() {
const words = field.val().trim().split(/\s+/).filter(Boolean).length;
counter.text(`${words} / ${limit} words`);
counter.toggleClass("red-text", words > limit);
}

field.on("input", updateCount);
updateCount();
});
});
2 changes: 1 addition & 1 deletion hackathon_site/event/static/event/js/landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ $(document).ready(function () {
}

// Delete the entire countdown if event start date has passed
if (eventStartDate < now) {
if (registrationOpenDate === null || eventStartDate < now) {
$("#countdown").remove();
$("#aboutText").removeClass("l7");
} else {
Expand Down
15 changes: 11 additions & 4 deletions hackathon_site/event/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class IndexViewTestCase(SetupUserMixin, TestCase):
"""
Tests for the landing page template.

We test for correct rendering and rendering of Logout/Register Your Interest buttons
We test the landing page links for open and closed registration.
"""

def setUp(self):
Expand All @@ -95,8 +95,12 @@ def setUp(self):
def test_index_view(self):
response = self.client.get(self.view)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertContains(response, "Register Your Interest")
self.assertContains(response, 'href="#interest"')
self.assertContains(
response,
'class="btn-small waves-effect waves-light colorBtn">Apply</a>',
count=2,
)
self.assertNotContains(response, "Register Your Interest")
self.assertContains(response, "Apply")
self.assertContains(response, reverse("registration:signup"))

Expand Down Expand Up @@ -134,9 +138,12 @@ def test_no_apply_button_when_registration_closed(self, mock_is_registration_ope
mock_is_registration_open.return_value = False
response = self.client.get(self.view)
self.assertNotContains(response, reverse("registration:signup"))
self.assertNotContains(response, 'href="#interest"')

def test_interest_form_renders(self):
@patch("event.views.is_registration_open")
def test_interest_form_renders(self, mock_is_registration_open):
"""The public MLH interest form and its checkboxes render on the page."""
mock_is_registration_open.return_value = False
response = self.client.get(self.view)
self.assertContains(response, "Register Your Interest")
self.assertContains(response, "MLH Code of Conduct")
Expand Down
4 changes: 2 additions & 2 deletions hackathon_site/hackathon_site/settings/__init__.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't set the registration open date yet. We will change when we open applications

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New state where there is no more register your interest, but applications haven't opened yet either

Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@
CONTACT_EMAIL = DEFAULT_FROM_EMAIL
HSS_ADMIN_EMAIL = "hardware@makeuoft.ca"

REGISTRATION_OPEN_DATE = datetime(2025, 12, 10, tzinfo=TZ_INFO)
REGISTRATION_CLOSE_DATE = datetime(2026, 1, 28, 23, 59, 0, tzinfo=TZ_INFO)
REGISTRATION_OPEN_DATE = None
REGISTRATION_CLOSE_DATE = datetime(2027, 1, 28, 23, 59, 0, tzinfo=TZ_INFO)
EVENT_START_DATE = datetime(2026, 2, 14, 8, 0, 0, tzinfo=TZ_INFO)
EVENT_END_DATE = datetime(2026, 2, 15, 17, 0, 0, tzinfo=TZ_INFO)
HARDWARE_SIGN_OUT_START_DATE = datetime(2026, 2, 8, 23, 59, 0, tzinfo=TZ_INFO)
Expand Down
4 changes: 4 additions & 0 deletions hackathon_site/hackathon_site/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ def _make_event_profile(self, user=None, team=None):

@override_settings(IN_TESTING=False)
class IsRegistrationOpenTestCase(TestCase):
@override_settings(REGISTRATION_OPEN_DATE=None)
def test_no_opening_date(self):
self.assertFalse(is_registration_open())

@override_settings(
REGISTRATION_OPEN_DATE=datetime(2020, 1, 2, tzinfo=settings.TZ_INFO)
)
Expand Down
3 changes: 3 additions & 0 deletions hackathon_site/hackathon_site/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def is_registration_open():
# So tests don't rely on the date, default to true
return True

if settings.REGISTRATION_OPEN_DATE is None:
return False

# datetime.now() returns the system native time, so this assumes that the system timezone
# is configured to match TIME_ZONE. We then make the datetime object timezone-aware.
now = datetime.now().replace(tzinfo=settings.TZ_INFO)
Expand Down
52 changes: 30 additions & 22 deletions hackathon_site/registration/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@
from registration.widgets import MaterialFileInput
from review.models import Review

MAX_WRITTEN_RESPONSE_WORDS = 250
WRITTEN_RESPONSE_FIELDS = (
"past_hackathon_info",
"community_problem",
"proud_project",
"deadline_plan",
)


def validate_written_response_length(value):
if len(value.split()) > MAX_WRITTEN_RESPONSE_WORDS:
raise forms.ValidationError(
_("Please use no more than 250 words."), code="too_many_words"
)


class SignUpForm(UserCreationForm):
"""
Expand Down Expand Up @@ -148,10 +163,9 @@ class Meta:
"devpost",
"how_many_hackathons",
"past_hackathon_info",
"what_past_experience",
"why_participate",
"what_technical_experience",
"one_million_dollars_investment",
"community_problem",
"proud_project",
"deadline_plan",
"discovery_method",
"conduct_agree",
"logistics_agree",
Expand Down Expand Up @@ -184,36 +198,28 @@ class Meta:
attrs={
"class": "materialize-textarea",
"placeholder": "Insert past hackathon description here...",
"data-length": 1000,
}
),
"what_past_experience": forms.Textarea(
attrs={
"class": "materialize-textarea",
"placeholder": "The most significant challenge I faced in a project/hackathon was...",
"data-length": 1000,
"style": "padding-top: 38px;",
"data-max-words": MAX_WRITTEN_RESPONSE_WORDS,
}
),
"why_participate": forms.Textarea(
"community_problem": forms.Textarea(
attrs={
"class": "materialize-textarea",
"placeholder": "I want to participate in MakeUofT because...",
"data-length": 1000,
"placeholder": "I would use technology to solve...",
"data-max-words": MAX_WRITTEN_RESPONSE_WORDS,
}
),
"what_technical_experience": forms.Textarea(
"proud_project": forms.Textarea(
attrs={
"class": "materialize-textarea",
"placeholder": "My technical experience with software and hardware are...",
"data-length": 1000,
"placeholder": "One project I was especially proud of was...",
"data-max-words": MAX_WRITTEN_RESPONSE_WORDS,
}
),
"one_million_dollars_investment": forms.Textarea(
"deadline_plan": forms.Textarea(
attrs={
"class": "materialize-textarea",
"placeholder": "If I had a million dollars to invest in one technology brand, it would be...",
"data-length": 1000,
"placeholder": "My plan would be...",
"data-max-words": MAX_WRITTEN_RESPONSE_WORDS,
}
),
"phone_number": forms.TextInput(attrs={"placeholder": "+1 (123) 456-7890"}),
Expand All @@ -226,6 +232,8 @@ def __init__(self, *args, **kwargs):
self.label_suffix = ""
self.fields["conduct_agree"].required = True
self.fields["logistics_agree"].required = True
for field_name in WRITTEN_RESPONSE_FIELDS:
self.fields[field_name].validators.append(validate_written_response_length)

def clean(self):
if not is_registration_open():
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 @@ -6,7 +6,25 @@
<link rel="stylesheet" type="text/css" href="{{ static('event/styles/css/select2.css') }}"/>

<style>

.input-field.static-label {
margin-top: 0;
}

.input-field.static-label > label {
position: static;
display: block;
width: 100%;
margin-bottom: 0;
font-size: 1.1rem !important;
line-height: 1.5;
white-space: normal;
transform: none !important;
}

.input-field.static-label > textarea.materialize-textarea {
min-height: 3rem;
padding-top: 0.8rem;
}
</style>
{% endblock %}

Expand Down Expand Up @@ -73,11 +91,10 @@ <h4>Online Profiles</h4>
<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.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.one_million_dollars_investment, show_help_text_as_label=True) }}
{{ render_field(form.past_hackathon_info, show_help_text_as_label=True, label_above=True) }}
{{ render_field(form.community_problem, show_help_text_as_label=True, label_above=True) }}
{{ render_field(form.proud_project, show_help_text_as_label=True, label_above=True) }}
{{ render_field(form.deadline_plan, show_help_text_as_label=True, label_above=True) }}
{{ render_field(form.discovery_method, show_help_text_as_label=True, size="s12 select2-wrapper") }}

<div class="col s12">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
<div class="section">
<div class="loginDiv z-depth-1 row">
<div class="row col s12 flexColCenter">
{% if localtime(now()) < registration_open_date %}
{% if registration_open_date is none %}
<h1 class="formH1">Applications have not opened yet</h1>
<p>The application opening date for {{ hackathon_name }} will be announced soon. Please check back!</p>
{% elif localtime(now()) < registration_open_date %}
<h1 class="formH1">Applications have not opened yet</h1>
<p>Applications for {{ hackathon_name }} will open on {{ localtime(registration_open_date)|strftime("%B %-d, %Y") }}. Please check back then!</p>
{% elif registration_open_date <= localtime(now()) < registration_close_date %}
Expand Down
40 changes: 40 additions & 0 deletions hackathon_site/registration/migrations/0016_auto_20261122_1951.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generated by Django 3.2.15 on 2026-11-23 00:51

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("registration", "0015_fix_mlh_dev_link_text"),
]

operations = [
migrations.AddField(
model_name="application",
name="community_problem",
field=models.TextField(
default="",
help_text="What is one problem in your community or everyday life that you would like to solve through technology?",
max_length=1000,
),
),
migrations.AddField(
model_name="application",
name="deadline_plan",
field=models.TextField(
default="",
help_text="It’s 11 PM, and you have a project due at 11 AM tomorrow. Would you choose to stay up late or wake up early to finish it, and what would your plan be?",
max_length=1000,
),
),
migrations.AddField(
model_name="application",
name="proud_project",
field=models.TextField(
default="",
help_text="Tell us a project that you have made in the past (technical or non-technical) that you are most proud of? What aspect of that project stood out to you?",
max_length=1000,
),
),
]
Loading
Loading