From 15bfc9c482238af1ed4de4aa69cb71dd66c69cec Mon Sep 17 00:00:00 2001 From: Yaoyao Date: Thu, 11 Dec 2025 18:34:29 +0100 Subject: [PATCH 1/3] appli volunteer: added write option in hear_about_us question --- applications/forms/volunteer.py | 12 ++++++++++++ ...volunteerapplication_other_hear_about_us.py | 18 ++++++++++++++++++ applications/models/volunteer.py | 1 + .../templates/include/application_form.html | 6 ++++++ .../templates/other_application_detail.html | 1 + 5 files changed, 38 insertions(+) create mode 100644 applications/migrations/0060_volunteerapplication_other_hear_about_us.py diff --git a/applications/forms/volunteer.py b/applications/forms/volunteer.py index bf3f887fa..6c8e47c05 100644 --- a/applications/forms/volunteer.py +++ b/applications/forms/volunteer.py @@ -85,6 +85,7 @@ def __init__(self, *args, **kwargs): {"name": "other_gender", "space": 12}, {"name": "under_age", "space": 12}, {"name": "hear_about_us", "space": 12}, + {"name": "other_hear_about_us", "space": 12}, {"name": "origin", "space": 12}, ], "description": "Hola voluntari@, necesitamos un poco de información antes de empezar :)", @@ -121,6 +122,15 @@ def __init__(self, *args, **kwargs): }, } + def clean_other_hear_about_us(self): + hear_about_us = self.cleaned_data.get("hear_about_us") + other_hear_about_us = self.cleaned_data.get("other_hear_about_us", None) + if hear_about_us == "Otros" and not other_hear_about_us: + raise forms.ValidationError( + "Por favor especifica cómo nos conociste" + ) + return other_hear_about_us + def clean(self): volunteer = self.cleaned_data["first_time_volunteer"] data = self.cleaned_data["which_hack"] @@ -240,6 +250,7 @@ def clean_hear_about_us(self): "graduation_year": forms.HiddenInput(), "phone_number": forms.HiddenInput(), "hear_about_us": CustomSelect(choices=models.HEARABOUTUS_ES), + "other_hear_about_us": forms.TextInput(attrs={"autocomplete": "off"}), "tshirt_size": forms.Select(), "diet": forms.Select(), } @@ -260,6 +271,7 @@ def clean_hear_about_us(self): "cool_skill": "¿Qué habilidad interesante o dato curioso tienes? ¡Sorpréndenos! 🎉", "friends": "¿Estás aplicando con otr@s amig@s? Escribe sus nombres completos", "hear_about_us": "¿Cómo escuchaste sobre nosotros por primera vez?", + "other_hear_about_us": "Especifica cómo nos conociste:", "volunteer_motivation": "¿Por qué quieres asistir como voluntari@ a HackUPC?", } diff --git a/applications/migrations/0060_volunteerapplication_other_hear_about_us.py b/applications/migrations/0060_volunteerapplication_other_hear_about_us.py new file mode 100644 index 000000000..dc20a633c --- /dev/null +++ b/applications/migrations/0060_volunteerapplication_other_hear_about_us.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.23 on 2025-12-11 17:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('applications', '0059_remove_volunteerapplication_pronouns'), + ] + + operations = [ + migrations.AddField( + model_name='volunteerapplication', + name='other_hear_about_us', + field=models.CharField(blank=True, max_length=500, null=True), + ), + ] diff --git a/applications/models/volunteer.py b/applications/models/volunteer.py index 8426518a5..50de7ea55 100644 --- a/applications/models/volunteer.py +++ b/applications/models/volunteer.py @@ -83,6 +83,7 @@ class VolunteerApplication(BaseApplication): #About us hear_about_us = models.CharField(max_length=300, choices=HEARABOUTUS_ES, default="") + other_hear_about_us = models.CharField(max_length=500, blank=True, null=True) # University graduation_year = models.IntegerField(choices=YEARS, default=DEFAULT_YEAR) diff --git a/applications/templates/include/application_form.html b/applications/templates/include/application_form.html index a40ea637a..70220ab86 100644 --- a/applications/templates/include/application_form.html +++ b/applications/templates/include/application_form.html @@ -227,6 +227,12 @@ conditional_field(other_gender, gender, function () { return gender.val() === 'X'; }, 1); + + var other_hear_about_us = $('#id_other_hear_about_us'); + var hear_about_us = $('#id_hear_about_us'); + conditional_field(other_hear_about_us, hear_about_us, function () { + return hear_about_us.val() === 'Otros'; + }, 1); var online = $('input[name="online"][value="True"]'); var face_to_face = $('input[name="online"][value="False"]'); diff --git a/organizers/templates/other_application_detail.html b/organizers/templates/other_application_detail.html index fa45f5a8d..9d2162e1f 100644 --- a/organizers/templates/other_application_detail.html +++ b/organizers/templates/other_application_detail.html @@ -76,6 +76,7 @@

Other questions

{% include 'include/field.html' with desc='Dietary restrictions' value=app.diet %} {% include 'include/field.html' with desc='Other diet' value=app.other_diet %} {% include 'include/field.html' with desc='How you meet us' value=app.hear_about_us %} + {% include 'include/field.html' with desc='Other (how you meet us)' value=app.other_hear_about_us %}

Extra

From d03204be8660a53ef4f45384647383af819f0116 Mon Sep 17 00:00:00 2001 From: Yaoyao Date: Thu, 11 Dec 2025 18:39:59 +0100 Subject: [PATCH 2/3] appli volunteer: make other_hear_about_us optional --- applications/forms/volunteer.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/applications/forms/volunteer.py b/applications/forms/volunteer.py index 6c8e47c05..0c93d5b1a 100644 --- a/applications/forms/volunteer.py +++ b/applications/forms/volunteer.py @@ -122,15 +122,6 @@ def __init__(self, *args, **kwargs): }, } - def clean_other_hear_about_us(self): - hear_about_us = self.cleaned_data.get("hear_about_us") - other_hear_about_us = self.cleaned_data.get("other_hear_about_us", None) - if hear_about_us == "Otros" and not other_hear_about_us: - raise forms.ValidationError( - "Por favor especifica cómo nos conociste" - ) - return other_hear_about_us - def clean(self): volunteer = self.cleaned_data["first_time_volunteer"] data = self.cleaned_data["which_hack"] From c1c18777714ca5dadb5be4fcdcc90813a66309c1 Mon Sep 17 00:00:00 2001 From: polmf <99polmf@gmail.com> Date: Sun, 21 Dec 2025 17:43:45 -0500 Subject: [PATCH 3/3] solve migrations conflicts --- ...us.py => 0061_volunteerapplication_other_hear_about_us.py} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename applications/migrations/{0060_volunteerapplication_other_hear_about_us.py => 0061_volunteerapplication_other_hear_about_us.py} (73%) diff --git a/applications/migrations/0060_volunteerapplication_other_hear_about_us.py b/applications/migrations/0061_volunteerapplication_other_hear_about_us.py similarity index 73% rename from applications/migrations/0060_volunteerapplication_other_hear_about_us.py rename to applications/migrations/0061_volunteerapplication_other_hear_about_us.py index dc20a633c..a32e25f01 100644 --- a/applications/migrations/0060_volunteerapplication_other_hear_about_us.py +++ b/applications/migrations/0061_volunteerapplication_other_hear_about_us.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.23 on 2025-12-11 17:25 +# Generated by Django 3.2.23 on 2025-12-21 22:39 from django.db import migrations, models @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('applications', '0059_remove_volunteerapplication_pronouns'), + ('applications', '0060_volunteerapplication_studies_and_course'), ] operations = [