diff --git a/hackathon_site/event/jinja2/event/base.html b/hackathon_site/event/jinja2/event/base.html index 73234f9..c3ce355 100644 --- a/hackathon_site/event/jinja2/event/base.html +++ b/hackathon_site/event/jinja2/event/base.html @@ -50,9 +50,11 @@ Logout {% else %} -
  • - Register Your Interest -
  • + {% if is_registration_open() %} +
  • + Apply +
  • + {% endif %} {% endif %} {% endblock %} diff --git a/hackathon_site/event/jinja2/event/form_base.html b/hackathon_site/event/jinja2/event/form_base.html index 644129a..3087d79 100644 --- a/hackathon_site/event/jinja2/event/form_base.html +++ b/hackathon_site/event/jinja2/event/form_base.html @@ -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="") %} -
    +{% macro render_field(field, show_help_text=False, show_label=True, show_help_text_as_label=False, size="s12", id="", label_above=False) %} +
    + {% if show_label and label_above %} + + {% endif %} {{ field }} - {% if show_label %} + {% if show_label and not label_above %} {% if show_help_text_as_label %} {% else %} diff --git a/hackathon_site/event/jinja2/event/landing.html b/hackathon_site/event/jinja2/event/landing.html index 33971b8..8ef8e0b 100644 --- a/hackathon_site/event/jinja2/event/landing.html +++ b/hackathon_site/event/jinja2/event/landing.html @@ -5,7 +5,7 @@ {% block head_extends %} @@ -102,6 +102,7 @@

    + {% if not is_registration_open() %}
    {% set msgs = get_messages(request) %} @@ -169,6 +170,7 @@

    Register Your Interest

    + {% endif %}
    diff --git a/hackathon_site/event/migrations/0014_auto_20261123_1432.py b/hackathon_site/event/migrations/0014_auto_20261123_1432.py new file mode 100644 index 0000000..48e6218 --- /dev/null +++ b/hackathon_site/event/migrations/0014_auto_20261123_1432.py @@ -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 DEV) in line with the MLH Privacy Policy. I further agree to the terms of both the MLH Contest Terms and Conditions and the MLH Privacy Policy.', + ), + ), + ] diff --git a/hackathon_site/event/models.py b/hackathon_site/event/models.py index 884bf63..6367181 100644 --- a/hackathon_site/event/models.py +++ b/hackathon_site/event/models.py @@ -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 " 'DEV) in line with the ' - "MLH Privacy Policy. " + 'MLH Privacy Policy. ' "I further agree to the terms of both the " 'MLH Contest Terms and Conditions' " and the " - "MLH Privacy Policy.", + 'MLH Privacy Policy.', 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, diff --git a/hackathon_site/event/static/event/js/application.js b/hackathon_site/event/static/event/js/application.js index 1ba6285..bca0df4 100644 --- a/hackathon_site/event/static/event/js/application.js +++ b/hackathon_site/event/static/event/js/application.js @@ -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 = $(''); + 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(); + }); }); diff --git a/hackathon_site/event/static/event/js/landing.js b/hackathon_site/event/static/event/js/landing.js index f9a0557..9ce03c4 100644 --- a/hackathon_site/event/static/event/js/landing.js +++ b/hackathon_site/event/static/event/js/landing.js @@ -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 { diff --git a/hackathon_site/event/tests.py b/hackathon_site/event/tests.py index 1c7cd68..a2c3e52 100644 --- a/hackathon_site/event/tests.py +++ b/hackathon_site/event/tests.py @@ -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): @@ -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', + count=2, + ) + self.assertNotContains(response, "Register Your Interest") self.assertContains(response, "Apply") self.assertContains(response, reverse("registration:signup")) @@ -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") diff --git a/hackathon_site/hackathon_site/settings/__init__.py b/hackathon_site/hackathon_site/settings/__init__.py index cdaa461..43d7e90 100644 --- a/hackathon_site/hackathon_site/settings/__init__.py +++ b/hackathon_site/hackathon_site/settings/__init__.py @@ -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) diff --git a/hackathon_site/hackathon_site/tests.py b/hackathon_site/hackathon_site/tests.py index d59f4de..6672be9 100644 --- a/hackathon_site/hackathon_site/tests.py +++ b/hackathon_site/hackathon_site/tests.py @@ -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) ) diff --git a/hackathon_site/hackathon_site/utils.py b/hackathon_site/hackathon_site/utils.py index f31e9ff..cf8b2e7 100644 --- a/hackathon_site/hackathon_site/utils.py +++ b/hackathon_site/hackathon_site/utils.py @@ -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) diff --git a/hackathon_site/registration/forms.py b/hackathon_site/registration/forms.py index f0ab331..046b4c0 100644 --- a/hackathon_site/registration/forms.py +++ b/hackathon_site/registration/forms.py @@ -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): """ @@ -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", @@ -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"}), @@ -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(): diff --git a/hackathon_site/registration/jinja2/registration/application.html b/hackathon_site/registration/jinja2/registration/application.html index 4bef644..a3da9f1 100644 --- a/hackathon_site/registration/jinja2/registration/application.html +++ b/hackathon_site/registration/jinja2/registration/application.html @@ -6,7 +6,25 @@ {% endblock %} @@ -73,11 +91,10 @@

    Online Profiles

    Questions

    {{ 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") }}
    diff --git a/hackathon_site/registration/jinja2/registration/signup_closed.html b/hackathon_site/registration/jinja2/registration/signup_closed.html index 9cf7e8f..c65331f 100644 --- a/hackathon_site/registration/jinja2/registration/signup_closed.html +++ b/hackathon_site/registration/jinja2/registration/signup_closed.html @@ -8,7 +8,10 @@
    - {% if localtime(now()) < registration_open_date %} + {% if registration_open_date is none %} +

    Applications have not opened yet

    +

    The application opening date for {{ hackathon_name }} will be announced soon. Please check back!

    + {% elif localtime(now()) < registration_open_date %}

    Applications have not opened yet

    Applications for {{ hackathon_name }} will open on {{ localtime(registration_open_date)|strftime("%B %-d, %Y") }}. Please check back then!

    {% elif registration_open_date <= localtime(now()) < registration_close_date %} diff --git a/hackathon_site/registration/migrations/0016_auto_20261122_1951.py b/hackathon_site/registration/migrations/0016_auto_20261122_1951.py new file mode 100644 index 0000000..e977989 --- /dev/null +++ b/hackathon_site/registration/migrations/0016_auto_20261122_1951.py @@ -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, + ), + ), + ] diff --git a/hackathon_site/registration/migrations/0017_auto_20261123_1432.py b/hackathon_site/registration/migrations/0017_auto_20261123_1432.py new file mode 100644 index 0000000..8dd3a9a --- /dev/null +++ b/hackathon_site/registration/migrations/0017_auto_20261123_1432.py @@ -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 = [ + ("registration", "0016_auto_20261122_1951"), + ] + + operations = [ + migrations.AlterField( + model_name="application", + 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="application", + 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 DEV) in line with the MLH Privacy Policy. I further agree to the terms of both the MLH Contest Terms and Conditions and the MLH Privacy Policy.', + ), + ), + ] diff --git a/hackathon_site/registration/migrations/0018_written_response_word_limit.py b/hackathon_site/registration/migrations/0018_written_response_word_limit.py new file mode 100644 index 0000000..76888d3 --- /dev/null +++ b/hackathon_site/registration/migrations/0018_written_response_word_limit.py @@ -0,0 +1,42 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("registration", "0017_auto_20261123_1432"), + ] + + operations = [ + migrations.AlterField( + model_name="application", + name="past_hackathon_info", + field=models.TextField( + default="", + help_text="If you've been to prior hackathon(s), please indicate the hackathon name, your project name and any prizes you won.", + ), + ), + migrations.AlterField( + 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?", + ), + ), + migrations.AlterField( + 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?", + ), + ), + migrations.AlterField( + 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?", + ), + ), + ] diff --git a/hackathon_site/registration/models.py b/hackathon_site/registration/models.py index 00b638e..d3e95c2 100644 --- a/hackathon_site/registration/models.py +++ b/hackathon_site/registration/models.py @@ -316,7 +316,6 @@ class Application(models.Model): null=False, default="", help_text="If you've been to prior hackathon(s), please indicate the hackathon name, your project name and any prizes you won.", - max_length=1000, ) what_past_experience = models.TextField( null=False, @@ -340,6 +339,21 @@ class Application(models.Model): help_text="If you had a million dollars to invest in one technology brand, what would it be and why?", max_length=1000, ) + community_problem = models.TextField( + null=False, + default="", + help_text="What is one problem in your community or everyday life that you would like to solve through technology?", + ) + proud_project = models.TextField( + null=False, + 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?", + ) + deadline_plan = models.TextField( + null=False, + 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?", + ) discovery_method = models.TextField( null=False, default="", @@ -358,18 +372,18 @@ class Application(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 " 'DEV) in line with the ' - "MLH Privacy Policy. " + 'MLH Privacy Policy. ' "I further agree to the terms of both the " 'MLH Contest Terms and Conditions' " and the " - "MLH Privacy Policy.", + 'MLH Privacy Policy.', 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, diff --git a/hackathon_site/registration/test_forms.py b/hackathon_site/registration/test_forms.py index 0d3b321..aefa1d5 100644 --- a/hackathon_site/registration/test_forms.py +++ b/hackathon_site/registration/test_forms.py @@ -101,10 +101,9 @@ def setUp(self): "program": "computer science", "how_many_hackathons": "2", "past_hackathon_info": "n/a", - "what_past_experience": "foo", - "why_participate": "foo", - "what_technical_experience": "foo", - "one_million_dollars_investment": "foo", + "community_problem": "foo", + "proud_project": "foo", + "deadline_plan": "foo", "discovery_method": "instagram", "conduct_agree": True, "logistics_agree": True, @@ -217,6 +216,31 @@ def test_phone_number_regex(self): self.assertFalse(form.is_valid(), msg=number) self.assertIn("Enter a valid phone number.", form.errors["phone_number"]) + def test_written_response_word_limit(self): + written_responses = ( + "past_hackathon_info", + "community_problem", + "proud_project", + "deadline_plan", + ) + for field in written_responses: + with self.subTest(field=field): + data = self.data.copy() + data[field] = " " + "word\n" * 250 + form = self._build_form(data=data) + self.assertTrue(form.is_valid(), msg=form.errors) + + data[field] += "extra" + form = self._build_form(data=data) + self.assertFalse(form.is_valid()) + self.assertIn("Please use no more than 250 words.", form.errors[field]) + + def test_written_responses_can_exceed_old_character_limit(self): + data = self.data.copy() + data["community_problem"] = "longword " * 200 + form = self._build_form(data=data) + self.assertTrue(form.is_valid(), msg=form.errors) + def test_phone_number_clean_up(self): unclean_to_clean_numbers = ("+1 (123) 246-7890", "11232467890") diff --git a/hackathon_site/registration/test_views.py b/hackathon_site/registration/test_views.py index eaa1c32..bbf3951 100644 --- a/hackathon_site/registration/test_views.py +++ b/hackathon_site/registration/test_views.py @@ -81,6 +81,12 @@ class SignUpClosedViewTestCase(TestCase): def setUp(self): self.view = reverse("registration:signup_closed") + @override_settings(REGISTRATION_OPEN_DATE=None) + def test_opening_date_not_announced(self): + response = self.client.get(self.view) + self.assertContains(response, "Applications have not opened yet") + self.assertContains(response, "will be announced soon") + @override_settings( REGISTRATION_OPEN_DATE=datetime(2020, 1, 2, tzinfo=settings.TZ_INFO) ) @@ -189,10 +195,9 @@ def setUp(self): "program": "computer science", "how_many_hackathons": "2", "past_hackathon_info": "n/a", - "what_past_experience": "foo", - "why_participate": "foo", - "what_technical_experience": "foo", - "one_million_dollars_investment": "foo", + "community_problem": "foo", + "proud_project": "foo", + "deadline_plan": "foo", "discovery_method": "instagram", "conduct_agree": True, "logistics_agree": True, diff --git a/hackathon_site/review/admin.py b/hackathon_site/review/admin.py index be934aa..ecb6393 100644 --- a/hackathon_site/review/admin.py +++ b/hackathon_site/review/admin.py @@ -126,6 +126,9 @@ class ApplicationInline(admin.TabularInline): "github", "devpost", "past_hackathon_info", + "community_problem", + "proud_project", + "deadline_plan", "what_past_experience", "why_participate", "what_technical_experience",