diff --git a/app/templates/base.html b/app/templates/base.html index 42ae66049..1a6d4b2be 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -96,7 +96,7 @@
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.
'} + fields["HackUPC Policies"] = { + "fields": polices_fields, + "description": '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.
", + } 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", + ] diff --git a/applications/forms/volunteer.py b/applications/forms/volunteer.py index 73d399864..c9a5bb215 100644 --- a/applications/forms/volunteer.py +++ b/applications/forms/volunteer.py @@ -4,12 +4,11 @@ class VolunteerApplicationForm(_BaseApplicationForm): - diet = forms.ChoiceField( required=True, - label='Restricciones alimentarias', + label="Restricciones alimentarias", choices=models.DIETS_ES, - help_text="Estas son las diferentes opciones que tenemos. No podemos asegurar que la carne sea hallal." + help_text="Estas son las diferentes opciones que tenemos. No podemos asegurar que la carne sea halal.", ) first_timer = forms.BooleanField( @@ -17,23 +16,25 @@ class VolunteerApplicationForm(_BaseApplicationForm): ) first_time_volunteer = forms.TypedChoiceField( required=True, - label="ÂżEs tu primera vez haciendo voluntariado en %s?" % settings.HACKATHON_NAME, + label="ÂżEs tu primera vez haciendo voluntariado en %s?" + % settings.HACKATHON_NAME, coerce=lambda x: x == "True", choices=((True, "SĂ"), (False, "No")), widget=forms.RadioSelect, ) which_hack = forms.MultipleChoiceField( required=False, - label="ÂżEn quĂ© ediciones de %s has participado como voluntari@?" % settings.HACKATHON_NAME, + label="ÂżEn quĂ© ediciones de %s has participado como voluntari@?" + % settings.HACKATHON_NAME, widget=forms.CheckboxSelectMultiple, - choices=models.PREVIOUS_HACKS, + choices=models.PREVIOUS_HACKS_VOLUNTEER, ) under_age = forms.TypedChoiceField( required=True, label="ÂżSerás mayor de edad en la fecha del evento?", initial=False, coerce=lambda x: x == "True", - choices=((False, "SĂ"),(True, "No")), + choices=((False, "SĂ"), (True, "No")), widget=forms.RadioSelect, ) studies_and_course = forms.CharField( @@ -48,7 +49,9 @@ class VolunteerApplicationForm(_BaseApplicationForm): help_text="No exigimos a nadie quedarse hasta ninguna hora en particular", widget=forms.RadioSelect, ) - lennyface = forms.CharField(initial="NA", widget=forms.HiddenInput(), required=False) + lennyface = forms.CharField( + initial="NA", widget=forms.HiddenInput(), required=False + ) university = forms.CharField( initial="NA", widget=forms.HiddenInput(), required=False @@ -59,18 +62,21 @@ class VolunteerApplicationForm(_BaseApplicationForm): terms_and_conditions = forms.BooleanField( required=False, label='He leĂdo, entendido y acepto los %s ' - 'TĂ©rminos y Condiciones ' - 'y la %s PolĂtica de Privacidad y Cookies' - '. ' - '*' % (settings.HACKATHON_NAME, settings.HACKATHON_NAME) - ) + "TĂ©rminos y Condiciones " + 'y la %s PolĂtica de Privacidad y Cookies' + '. ' + "*" % (settings.HACKATHON_NAME, settings.HACKATHON_NAME), + ) - email_subscribe = forms.BooleanField(required=False, label='SuscrĂbete a nuestra lista de marketing para informarte sobre nuestros prĂłximos eventos.') + email_subscribe = forms.BooleanField( + required=False, + label="SuscrĂbete a nuestra lista de marketing para informarte sobre nuestros prĂłximos eventos.", + ) diet_notice = forms.BooleanField( required=False, - label='Autorizo a "HackersAtUpc" a utilizar mi informaciĂłn sobre alergias e intolerancias alimentarias Ăşnicamente para gestionar el servicio de catering. *' + label='Autorizo a "HackersAtUpc" a utilizar mi informaciĂłn sobre alergias e intolerancias alimentarias Ăşnicamente para gestionar el servicio de catering. *', ) valid = forms.BooleanField( @@ -104,7 +110,7 @@ def __init__(self, *args, **kwargs): {"name": "attendance", "space": 12}, {"name": "volunteer_motivation", "space": 12}, ], - "description": "ÂżHas participado en eventos similares? ¡CuĂ©ntanos más!" + "description": "ÂżHas participado en eventos similares? ¡CuĂ©ntanos más!", }, "âť“ Otras Preguntas": { "fields": [ @@ -136,7 +142,6 @@ def clean(self): return super(VolunteerApplicationForm, self).clean() - def volunteer(self): return True @@ -223,14 +228,14 @@ class Meta(_BaseApplicationForm.Meta): } class CustomSelect(forms.Select): - def create_option( - self, name, value, label, selected, index, subindex=None, attrs=None - ): - if index == 0: - attrs = {"disabled": "disabled"} - return super().create_option( - name, value, label, selected, index, subindex=subindex, attrs=attrs - ) + def create_option( + self, name, value, label, selected, index, subindex=None, attrs=None + ): + if index == 0: + attrs = {"disabled": "disabled"} + return super().create_option( + name, value, label, selected, index, subindex=subindex, attrs=attrs + ) def clean_hear_about_us(self): hear_about_us = self.cleaned_data.get("hear_about_us") @@ -262,7 +267,8 @@ def clean_hear_about_us(self): "diet": "Restricciones alimentarias", "other_diet": "Otras dietas", "origin": "ÂżCuál es tu lugar de residencia actual?", - "which_hack": "ÂżEn quĂ© ediciones de %s has participado como voluntari@?" % settings.HACKATHON_NAME, + "which_hack": "ÂżEn quĂ© ediciones de %s has participado como voluntari@?" + % settings.HACKATHON_NAME, "attendance": "ÂżQuĂ© dĂas asistirás a HackUPC?", "languages": "ÂżEn quĂ© idiomas te sientes cĂłmod@ hablando?", "quality": "Nombra una cualidad tuya:", @@ -273,5 +279,3 @@ def clean_hear_about_us(self): "other_hear_about_us": "Especifica cĂłmo nos conociste:", "volunteer_motivation": "ÂżPor quĂ© quieres asistir como voluntari@ a HackUPC?", } - - diff --git a/applications/migrations/0064_auto_20260118_1201.py b/applications/migrations/0064_auto_20260118_1201.py new file mode 100644 index 000000000..065b4e3a8 --- /dev/null +++ b/applications/migrations/0064_auto_20260118_1201.py @@ -0,0 +1,39 @@ +# Generated by Django 3.2.23 on 2026-01-18 12:01 + +from django.db import migrations, models +import multiselectfield.db.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('applications', '0063_auto_20251228_1841'), + ] + + operations = [ + migrations.AlterField( + model_name='hackerapplication', + name='graduation_year', + field=models.IntegerField(choices=[(2025, '2025'), (2026, '2026'), (2027, '2027'), (2028, '2028'), (2029, '2029'), (2030, '2030'), (2031, '2031'), (2032, '2032')], default=2027), + ), + migrations.AlterField( + model_name='mentorapplication', + name='graduation_year', + field=models.IntegerField(choices=[(2025, '2025'), (2026, '2026'), (2027, '2027'), (2028, '2028'), (2029, '2029'), (2030, '2030'), (2031, '2031'), (2032, '2032')], default=2027), + ), + migrations.AlterField( + model_name='mentorapplication', + name='which_hack', + field=multiselectfield.db.fields.MultiSelectField(blank=True, choices=[(0, 'HackUPC 2019 or before'), (1, 'HackUPC 2021'), (2, 'HackUPC 2022'), (3, 'HackUPC 2023'), (4, 'HackUPC 2024'), (5, 'HackUPC 2025')], max_length=11, null=True), + ), + migrations.AlterField( + model_name='volunteerapplication', + name='graduation_year', + field=models.IntegerField(choices=[(2025, '2025'), (2026, '2026'), (2027, '2027'), (2028, '2028'), (2029, '2029'), (2030, '2030'), (2031, '2031'), (2032, '2032')], default=2027), + ), + migrations.AlterField( + model_name='volunteerapplication', + name='which_hack', + field=multiselectfield.db.fields.MultiSelectField(choices=[(0, 'HackUPC 2019 o anterior'), (1, 'HackUPC 2021'), (2, 'HackUPC 2022'), (3, 'HackUPC 2023'), (4, 'HackUPC 2024'), (5, 'HackUPC 2025')], max_length=11), + ), + ] diff --git a/applications/models/constants.py b/applications/models/constants.py index bb4affc02..25fa0eac8 100644 --- a/applications/models/constants.py +++ b/applications/models/constants.py @@ -1,79 +1,79 @@ from datetime import datetime -from app import utils, hackathon_variables - -APP_PENDING = 'P' -APP_REJECTED = 'R' -APP_INVITED = 'I' -APP_LAST_REMIDER = 'LR' -APP_CONFIRMED = 'C' -APP_CANCELLED = 'X' -APP_ATTENDED = 'A' -APP_EXPIRED = 'E' -APP_DUBIOUS = 'D' -APP_INVALID = 'IV' -APP_BLACKLISTED = 'BL' - -PENDING_TEXT = 'Under review' -DUBIOUS_TEXT = 'Dubious' -BLACKLIST_TEXT = 'Blacklisted' +from app import hackathon_variables + +APP_PENDING = "P" +APP_REJECTED = "R" +APP_INVITED = "I" +APP_LAST_REMIDER = "LR" +APP_CONFIRMED = "C" +APP_CANCELLED = "X" +APP_ATTENDED = "A" +APP_EXPIRED = "E" +APP_DUBIOUS = "D" +APP_INVALID = "IV" +APP_BLACKLISTED = "BL" + +PENDING_TEXT = "Under review" +DUBIOUS_TEXT = "Dubious" +BLACKLIST_TEXT = "Blacklisted" STATUS = [ (APP_PENDING, PENDING_TEXT), - (APP_REJECTED, 'Wait listed'), - (APP_INVITED, 'Invited'), - (APP_LAST_REMIDER, 'Last reminder'), - (APP_CONFIRMED, 'Confirmed'), - (APP_CANCELLED, 'Cancelled'), - (APP_ATTENDED, 'Attended'), - (APP_EXPIRED, 'Expired'), + (APP_REJECTED, "Wait listed"), + (APP_INVITED, "Invited"), + (APP_LAST_REMIDER, "Last reminder"), + (APP_CONFIRMED, "Confirmed"), + (APP_CANCELLED, "Cancelled"), + (APP_ATTENDED, "Attended"), + (APP_EXPIRED, "Expired"), (APP_DUBIOUS, DUBIOUS_TEXT), - (APP_INVALID, 'Invalid'), - (APP_BLACKLISTED, BLACKLIST_TEXT) + (APP_INVALID, "Invalid"), + (APP_BLACKLISTED, BLACKLIST_TEXT), ] -NO_ANSWER = 'NA' -MALE = 'M' -FEMALE = 'F' -NON_BINARY = 'NB' -GENDER_OTHER = 'X' +NO_ANSWER = "NA" +MALE = "M" +FEMALE = "F" +NON_BINARY = "NB" +GENDER_OTHER = "X" GENDERS = [ - (NO_ANSWER, 'Prefer not to answer'), - (MALE, 'Male'), - (FEMALE, 'Female'), - (NON_BINARY, 'Non-binary'), - (GENDER_OTHER, 'Prefer to self-describe'), + (NO_ANSWER, "Prefer not to answer"), + (MALE, "Male"), + (FEMALE, "Female"), + (NON_BINARY, "Non-binary"), + (GENDER_OTHER, "Prefer to self-describe"), ] -D_SELECT = '' -D_NONE = 'None' -D_VEGETARIAN = 'Vegetarian' -D_VEGAN = 'Vegan' -#D_NO_PORK = 'No pork' -D_GLUTEN_FREE = 'Gluten-free' -D_OTHER = 'Others' +D_SELECT = "" +D_NONE = "None" +D_VEGETARIAN = "Vegetarian" +D_VEGAN = "Vegan" +# D_NO_PORK = 'No pork' +D_GLUTEN_FREE = "Gluten-free" +D_OTHER = "Others" DIETS = [ - (D_SELECT, '- Select a diet -'), - (D_NONE, 'No requirements'), - (D_VEGETARIAN, 'Vegetarian'), - (D_VEGAN, 'Vegan'), - #(D_NO_PORK, 'No pork'), - (D_GLUTEN_FREE, 'Gluten-free'), - (D_OTHER, 'Others') + (D_SELECT, "- Select a diet -"), + (D_NONE, "No requirements"), + (D_VEGETARIAN, "Vegetarian"), + (D_VEGAN, "Vegan"), + # (D_NO_PORK, 'No pork'), + (D_GLUTEN_FREE, "Gluten-free"), + (D_OTHER, "Others"), ] -T_SELECT = '' -T_XXS = 'XXS' -T_XS = 'XS' -T_S = 'S' -T_M = 'M' -T_L = 'L' -T_XL = 'XL' -T_XXL = 'XXL' -T_XXXL = 'XXXL' +T_SELECT = "" +T_XXS = "XXS" +T_XS = "XS" +T_S = "S" +T_M = "M" +T_L = "L" +T_XL = "XL" +T_XXL = "XXL" +T_XXXL = "XXXL" TSHIRT_SIZES = [ - (T_SELECT, '- Select a t-shirt size -'), + (T_SELECT, "- Select a t-shirt size -"), (T_XS, "Unisex - XS"), (T_S, "Unisex - S"), (T_M, "Unisex - M"), @@ -85,44 +85,54 @@ DEFAULT_TSHIRT_SIZE = T_SELECT -ATTENDANCE = [ - (0, "Friday"), - (1, "Saturday"), - (2, "Sunday") -] +ATTENDANCE = [(0, "Friday"), (1, "Saturday"), (2, "Sunday")] -ST_SECONDARY = 'SECONDARY' -ST_VOCATIONAL = 'VOCATIONAL' -ST_BACHELOR = 'BACHELOR' -ST_MASTER = 'MASTER' -ST_OTHER = 'OTHER' +ST_SECONDARY = "SECONDARY" +ST_VOCATIONAL = "VOCATIONAL" +ST_BACHELOR = "BACHELOR" +ST_MASTER = "MASTER" +ST_OTHER = "OTHER" KIND_STUDIES = [ - (ST_SECONDARY, 'Secondary Education - Baccalaureate'), (ST_VOCATIONAL, 'Vocational Training (FP)'), - (ST_BACHELOR, 'Bachelor’s Degree'), (ST_MASTER, 'Master’s Degree'), (ST_OTHER, 'Other') + (ST_SECONDARY, "Secondary Education - Baccalaureate"), + (ST_VOCATIONAL, "Vocational Training (FP)"), + (ST_BACHELOR, "Bachelor’s Degree"), + (ST_MASTER, "Master’s Degree"), + (ST_OTHER, "Other"), +] + +HACK_NAME = getattr(hackathon_variables, "HACKATHON_NAME", "HackAssistant") +EXTRA_NAME_VOLUNTEER = [" 2019 o anterior", " 2021", " 2022", " 2023", " 2024", " 2025"] +EXTRA_NAME_MENTOR = [" 2019 or before", " 2021", " 2022", " 2023", " 2024", " 2025"] + +PREVIOUS_HACKS_VOLUNTEER = [ + (i, HACK_NAME + EXTRA_NAME_VOLUNTEER[i]) + for i in range(0, len(EXTRA_NAME_VOLUNTEER)) ] -HACK_NAME = getattr(hackathon_variables, 'HACKATHON_NAME', "HackAssistant") -EXTRA_NAME = ['2019 o anterior', ' 2021', ' 2022', ' 2023', ' 2024', ' 2025'] -PREVIOUS_HACKS = [(i, HACK_NAME + EXTRA_NAME[i]) for i in range(0, len(EXTRA_NAME))] +PREVIOUS_HACKS_MENTOR = [ + (i, HACK_NAME + EXTRA_NAME_MENTOR[i]) for i in range(0, len(EXTRA_NAME_MENTOR)) +] -YEARS = [(int(size), size) for size in ('2025 2026 2027 2028 2029 2030 2031 2032'.split(' '))] +YEARS = [ + (int(size), size) for size in ("2025 2026 2027 2028 2029 2030 2031 2032".split(" ")) +] DEFAULT_YEAR = datetime.now().year + 1 ENGLISH_LEVEL = [(i, str(i)) for i in range(1, 5 + 1)] -DUBIOUS_NONE = 'OK' -DUBIOUS_CV = 'INVALID_CV' -DUBIOUS_GRADUATION_YEAR = 'LATE_GRAD' -DUBIOUS_NOT_STUDENT = 'NOT_STUDENT' -DUBIOUS_SCHOOL = 'INVALID_SCHOOL' -DUBIOUS_OTHER = 'OTHER' +DUBIOUS_NONE = "OK" +DUBIOUS_CV = "INVALID_CV" +DUBIOUS_GRADUATION_YEAR = "LATE_GRAD" +DUBIOUS_NOT_STUDENT = "NOT_STUDENT" +DUBIOUS_SCHOOL = "INVALID_SCHOOL" +DUBIOUS_OTHER = "OTHER" DUBIOUS_TYPES = [ - (DUBIOUS_NONE, 'Not dubious'), - (DUBIOUS_CV, 'Invalid CV'), - (DUBIOUS_GRADUATION_YEAR, 'Invalid graduation year'), - (DUBIOUS_NOT_STUDENT, 'Not a student'), - (DUBIOUS_SCHOOL, 'Invalid school'), - (DUBIOUS_OTHER, 'Other') + (DUBIOUS_NONE, "Not dubious"), + (DUBIOUS_CV, "Invalid CV"), + (DUBIOUS_GRADUATION_YEAR, "Invalid graduation year"), + (DUBIOUS_NOT_STUDENT, "Not a student"), + (DUBIOUS_SCHOOL, "Invalid school"), + (DUBIOUS_OTHER, "Other"), ] diff --git a/applications/models/draft.py b/applications/models/draft.py index 8727e50f6..13da7affc 100644 --- a/applications/models/draft.py +++ b/applications/models/draft.py @@ -1,9 +1,9 @@ - - from user.models import User, BlacklistUser from user import models as userModels from .base import * + + class DraftApplication(models.Model): content = models.CharField(max_length=7000) user = models.OneToOneField(User, primary_key=True, on_delete=models.CASCADE) @@ -17,7 +17,14 @@ def get_dict(self): @staticmethod def create_draft_application(instance): dict = model_to_dict(instance) - for key in ['user', 'invited_by', 'submission_date', 'status_update_date', 'status', 'resume']: + for key in [ + "user", + "invited_by", + "submission_date", + "status_update_date", + "status", + "resume", + ]: dict.pop(key, None) d = DraftApplication() d.user_id = instance.user_id diff --git a/applications/models/hacker.py b/applications/models/hacker.py index f2170a5ba..75f3e6f64 100644 --- a/applications/models/hacker.py +++ b/applications/models/hacker.py @@ -14,7 +14,9 @@ class HackerApplication(BaseApplication): lennyface = models.CharField(max_length=20, default="-.-") # Studies - kind_studies = models.CharField(max_length=300, choices=KIND_STUDIES, default=NO_ANSWER) + kind_studies = models.CharField( + max_length=300, choices=KIND_STUDIES, default=NO_ANSWER + ) graduation_year = models.IntegerField(choices=YEARS, default=DEFAULT_YEAR) university = models.CharField(max_length=300) degree = models.CharField(max_length=300) @@ -35,13 +37,29 @@ class HackerApplication(BaseApplication): projects = models.TextField(max_length=500, blank=True, null=True) # META - dubious_type = models.CharField(max_length=300, choices=DUBIOUS_TYPES, default=DUBIOUS_NONE) # Type of dubious application - dubioused_by = models.ForeignKey(User, related_name='dubioused_by', blank=True, null=True, - on_delete=models.SET_NULL) # User who marked this application as dubious - dubious_comment = models.TextField(max_length=500, blank=True, null=True) # Comment for dubious application - contacted = models.BooleanField(default=False) # If a dubious application has been contacted yet - contacted_by = models.ForeignKey(User, related_name='contacted_by', blank=True, null=True, - on_delete=models.SET_NULL) + dubious_type = models.CharField( + max_length=300, choices=DUBIOUS_TYPES, default=DUBIOUS_NONE + ) # Type of dubious application + dubioused_by = models.ForeignKey( + User, + related_name="dubioused_by", + blank=True, + null=True, + on_delete=models.SET_NULL, + ) # User who marked this application as dubious + dubious_comment = models.TextField( + max_length=500, blank=True, null=True + ) # Comment for dubious application + contacted = models.BooleanField( + default=False + ) # If a dubious application has been contacted yet + contacted_by = models.ForeignKey( + User, + related_name="contacted_by", + blank=True, + null=True, + on_delete=models.SET_NULL, + ) reviewed = models.BooleanField( default=False @@ -91,11 +109,13 @@ def invalidate(self): Also, if the user has a team, it deletes it. """ if self.status != APP_DUBIOUS: - raise ValidationError('Applications can only be marked as invalid if they are dubious first') - self.status = APP_INVALID - team = getattr(self.user, 'team', None) + raise ValidationError( + "Applications can only be marked as invalid if they are dubious first" + ) + self.status = APP_INVALID + team = getattr(self.user, "team", None) if team: - team.delete() + team.delete() self.save() def set_dubious(self, user, dubious_type, dubious_comment_text): @@ -117,15 +137,15 @@ def unset_dubious(self): self.dubious_type = DUBIOUS_NONE self.dubious_comment = None self.save() - + def set_flagged_cv(self): """Sets the CV as flagged for review. If there was an accepted resume, deletes it so it can be reviewed.""" self.cv_flagged = True - if hasattr(self, 'acceptedresume'): + if hasattr(self, "acceptedresume"): self.acceptedresume.delete() self.save() - + def set_contacted(self, user): if not self.contacted: self.contacted = True @@ -149,7 +169,7 @@ def confirm_blacklist(self, user, motive_of_ban): self.user, motive_of_ban ) blacklist_user.save() - team = getattr(self.user, 'team', None) + team = getattr(self.user, "team", None) if team: team.delete() self.save() diff --git a/applications/models/mentor.py b/applications/models/mentor.py index d5c1f26d1..070daed36 100644 --- a/applications/models/mentor.py +++ b/applications/models/mentor.py @@ -1,3 +1,4 @@ +from datetime import timedelta from .base import * @@ -8,7 +9,7 @@ class MentorApplication( attendance = MultiSelectField(choices=ATTENDANCE) english_level = models.IntegerField(default=0, null=False, choices=ENGLISH_LEVEL) - which_hack = MultiSelectField(choices=PREVIOUS_HACKS, null=True, blank=True) + which_hack = MultiSelectField(choices=PREVIOUS_HACKS_MENTOR, null=True, blank=True) # Where is this person coming from? origin = models.CharField(max_length=300) @@ -17,7 +18,7 @@ class MentorApplication( first_timer = models.BooleanField(default=False) # Random lenny face - lennyface = models.CharField(max_length=20, default='-.-') + lennyface = models.CharField(max_length=20, default="-.-") # University graduation_year = models.IntegerField(choices=YEARS, default=DEFAULT_YEAR) @@ -51,4 +52,8 @@ class MentorApplication( valid = models.BooleanField(default=False) def can_be_edit(self, app_type="M"): - return self.status in [APP_PENDING, APP_DUBIOUS] and not utils.is_app_closed(app_type) + return ( + self.status in [APP_PENDING, APP_DUBIOUS] + and not utils.is_app_closed(app_type) + and self.submission_date + timedelta(hours=2) > timezone.now() + ) diff --git a/applications/models/sponsor.py b/applications/models/sponsor.py index 9f05f6674..8bef8ebd3 100644 --- a/applications/models/sponsor.py +++ b/applications/models/sponsor.py @@ -5,7 +5,7 @@ class SponsorApplication(models.Model): attendance = MultiSelectField(choices=ATTENDANCE) name = models.CharField( - verbose_name='Full name', + verbose_name="Full name", max_length=255, ) # When was the application submitted @@ -14,30 +14,40 @@ class SponsorApplication(models.Model): # When was the last status update status_update_date = models.DateTimeField(blank=True, null=True) uuid = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True) - user = models.ForeignKey(User, related_name='%(class)s_application', null=True, on_delete=models.SET_NULL) + user = models.ForeignKey( + User, related_name="%(class)s_application", null=True, on_delete=models.SET_NULL + ) # Application status - status = models.CharField(choices=STATUS, - default=APP_CONFIRMED, - max_length=2) - phone_number = models.CharField(blank=True, null=True, max_length=16, - validators=[RegexValidator(regex=r'^\+?1?\d{9,15}$', - message="Phone number must be entered in the format: \ - '+#########'. Up to 15 digits allowed.")]) + status = models.CharField(choices=STATUS, default=APP_CONFIRMED, max_length=2) + phone_number = models.CharField( + blank=True, + null=True, + max_length=16, + validators=[ + RegexValidator( + regex=r"^\+?1?\d{9,15}$", + message="Phone number must be entered in the format: \ + '+#########'. Up to 15 digits allowed.", + ) + ], + ) # Info for swag and food diet = models.CharField(max_length=300, choices=DIETS, default=D_NONE) other_diet = models.CharField(max_length=600, blank=True, null=True) - tshirt_size = models.CharField(max_length=300, default=DEFAULT_TSHIRT_SIZE, choices=TSHIRT_SIZES) + tshirt_size = models.CharField( + max_length=300, default=DEFAULT_TSHIRT_SIZE, choices=TSHIRT_SIZES + ) position = models.CharField(max_length=50, null=False) - email = models.EmailField(verbose_name='email', max_length=255, null=True) + email = models.EmailField(verbose_name="email", max_length=255, null=True) @property def uuid_str(self): return str(self.uuid) def __str__(self): - return self.name + ' from ' + self.user.name + return self.name + " from " + self.user.name def save(self, **kwargs): self.status_update_date = timezone.now() @@ -50,10 +60,10 @@ def check_in(self): def get_diet_color(self): colors = { - D_NONE: 'white', - D_VEGETARIAN: '#7ABE6F', + D_NONE: "white", + D_VEGETARIAN: "#7ABE6F", } - return colors.get(self.diet, '#42A2CB') + return colors.get(self.diet, "#42A2CB") class META: - unique_together = [['name', 'user']] + unique_together = [["name", "user"]] diff --git a/applications/models/volunteer.py b/applications/models/volunteer.py index c5f0b32d6..9ae5a17b3 100644 --- a/applications/models/volunteer.py +++ b/applications/models/volunteer.py @@ -1,69 +1,42 @@ from __future__ import unicode_literals - -import json -import os -import uuid as uuid -from datetime import datetime - -from django.core.exceptions import ValidationError -from django.core.validators import RegexValidator, MinValueValidator, MaxValueValidator from django.db import models -from django.db.models import Avg -from django.forms import model_to_dict -from django.utils import timezone from multiselectfield import MultiSelectField - -from app import utils, hackathon_variables -from user.models import User, BlacklistUser -from user import models as userModels -from applications.validators import validate_file_extension - +from app import utils from .base import * GENDERS_ES = [ - (NO_ANSWER, 'Prefiero no responder'), - (MALE, 'Hombre'), - (FEMALE, 'Mujer'), - (NON_BINARY, 'No binario'), - (GENDER_OTHER, 'Prefiero describirme'), + (NO_ANSWER, "Prefiero no responder"), + (MALE, "Hombre"), + (FEMALE, "Mujer"), + (NON_BINARY, "No binario"), + (GENDER_OTHER, "Prefiero describirme"), ] -LENGUAGUES_ES = [ -("Spanish", "Español"), -("Catalan", "Catalán"), -("English", "InglĂ©s") -] +LENGUAGUES_ES = [("Spanish", "Español"), ("Catalan", "Catalán"), ("English", "InglĂ©s")] -ATTENDANCE_ES = [ - (0, "Viernes"), - (1, "Sábado"), - (2, "Domingo") -] +ATTENDANCE_ES = [(0, "Viernes"), (1, "Sábado"), (2, "Domingo")] HEARABOUTUS_ES = [ -("Posters", "Posters"), -("Redes Sociales", "Redes Sociales"), -("Mesas en el bar de la FIB","Mesas en el bar de la FIB"), -("Mensajes por grupos de Whatsapp","Mensajes por grupos de Whatsapp"), -("Amigos, compañeros u otras personas","Amigos, compañeros u otras personas"), -("Anuncios online", "Anuncios online"), -("Otros", "Otros") + ("Posters", "Posters"), + ("Redes Sociales", "Redes Sociales"), + ("Mesas en el bar de la FIB", "Mesas en el bar de la FIB"), + ("Mensajes por grupos de Whatsapp", "Mensajes por grupos de Whatsapp"), + ("Amigos, compañeros u otras personas", "Amigos, compañeros u otras personas"), + ("Anuncios online", "Anuncios online"), + ("Otros", "Otros"), ] DIETS_ES = [ - (D_NONE, 'Sin requerimientos'), - (D_VEGETARIAN, 'Vegetariano'), - (D_VEGAN, 'Vegano'), - (D_GLUTEN_FREE, 'Sin gluten'), - (D_OTHER, 'Otros') + (D_NONE, "Sin requerimientos"), + (D_VEGETARIAN, "Vegetariano"), + (D_VEGAN, "Vegano"), + (D_GLUTEN_FREE, "Sin gluten"), + (D_OTHER, "Otros"), ] -NIGHT_SHIFT_ES = [ - ('No', 'No'), - ('Yes', 'SĂ'), - ('Maybe', 'Puede ser') -] +NIGHT_SHIFT_ES = [("No", "No"), ("Yes", "SĂ"), ("Maybe", "Puede ser")] + class VolunteerApplication(BaseApplication): @@ -81,7 +54,7 @@ class VolunteerApplication(BaseApplication): # Random lenny face lennyface = models.CharField(max_length=20, default="-.-") - #About us + # 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) @@ -93,16 +66,16 @@ class VolunteerApplication(BaseApplication): attendance = MultiSelectField(choices=ATTENDANCE_ES) languages = MultiSelectField(choices=LENGUAGUES_ES) - which_hack = MultiSelectField(choices=PREVIOUS_HACKS) + which_hack = MultiSelectField(choices=PREVIOUS_HACKS_VOLUNTEER) cool_skill = models.CharField(max_length=100, null=False) first_time_volunteer = models.BooleanField() quality = models.CharField(max_length=150, null=False) weakness = models.CharField(max_length=150, null=False) - + friends = models.CharField(max_length=100, null=True, blank=True) - night_shifts = MultiSelectField(choices=NIGHT_SHIFT_ES, default='No') - studies_and_course = models.CharField(max_length=500, blank=True, default='') + night_shifts = MultiSelectField(choices=NIGHT_SHIFT_ES, default="No") + studies_and_course = models.CharField(max_length=500, blank=True, default="") volunteer_motivation = models.CharField(max_length=500) valid = models.BooleanField(default=True) diff --git a/applications/templates/dashboard.html b/applications/templates/dashboard.html index 765d86d5c..4ae0831cc 100644 --- a/applications/templates/dashboard.html +++ b/applications/templates/dashboard.html @@ -32,7 +32,7 @@{% if app_type == 'H' or app_type == 'V' or app_type == 'M' %} - You are applying as a + You are applying as a {% elif is_sponsor %} You are applying for {{ company_name }} as a sponsor {% endif %} @@ -93,51 +93,51 @@
Thank you {{ user.get_full_name }} for confirming your attendance - to {{ h_name }}! In order to make registration go smoother, please show us this QR code during the - process so we can - easily find - you. -
-If you want to add your pass to Google Wallet, click on the "Add to Google Wallet" button. - Sadly, we don't support Apple Wallet, but you can donwload Google Wallet on your iPhone as well!
- {% if h_arrive %} -{{ h_arrive }}
- {% endif %} - {% if h_leave %} -{{ h_leave }}
- {% endif %} - {% else %} -Thank you {{ user.get_full_name }} for confirming your attendance - to {{ h_name }}!
- {% if application.online and application.is_confirmed and h_online_checkin %} - {% include 'include/online_checkin.html' %} - {% elif h_discord and not user.discorduser %} - {% include 'include/discord_button.html' %} - {% elif h_discord %} - {% include 'include/swag_button.html' %} + to {{ h_name }}! In order to make registration go smoother, please show us this QR code during the + process so we can + easily find + you. + +If you want to add your pass to Google Wallet, click on the "Add to Google Wallet" button. + Sadly, we don't support Apple Wallet, but you can download Google Wallet on your iPhone as well!
+ {% if h_arrive %} +{{ h_arrive }}
{% endif %} -{{ h_leave }}
+ {% endif %} + {% else %} +Thank you {{ user.get_full_name }} for confirming your attendance + to {{ h_name }}!
+ {% if application.online and application.is_confirmed and h_online_checkin %} + {% include 'include/online_checkin.html' %} + {% elif h_discord and not user.discorduser %} + {% include 'include/discord_button.html' %} + {% elif h_discord %} + {% include 'include/swag_button.html' %} + {% endif %} +Application has been marked as invalid. Please reach out to us at {{ h_contact_email|urlize }} if you think this is a mistake. - We are sorry your application, if you want you can apply at {{ h_name }} as mentor. + We are sorry your application, if you want you can apply at {{ h_name }} as mentor.
- Convert to mentor + Convert to mentorThank you so much for applying at {{ h_name }}!
When decisions are released, you'll be able to see your results on this page.
If you have any questions or concerns, you can still reach us at {{ h_contact_email|urlize }}
-