From d5621710240b3601622cfdf402d7c8a245533044 Mon Sep 17 00:00:00 2001 From: Mark Murnane Date: Thu, 3 Aug 2023 21:22:03 -0400 Subject: [PATCH 1/2] Fixing form validation bugs --- uber/forms/attendee.py | 8 ++++++++ uber/templates/preregistration/additional_info.html | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/uber/forms/attendee.py b/uber/forms/attendee.py index d62a8a9d3..541990463 100644 --- a/uber/forms/attendee.py +++ b/uber/forms/attendee.py @@ -168,6 +168,14 @@ def get_non_admin_locked_fields(self, attendee): def validate_shirt(form, field): if (form.amount_extra.data > 0 or form.badge_type.data in c.BADGE_TYPE_PRICES) and field.data == c.NO_SHIRT: raise ValidationError("Please select a shirt size.") + + def get_optional_fields(self, attendee, is_admin=False): + optional_list = super().get_optional_fields(attendee) + + if attendee.badge_type not in c.PREASSIGNED_BADGE_TYPES: + optional_list.append('badge_printed_name') + + return optional_list class OtherInfo(MagForm): diff --git a/uber/templates/preregistration/additional_info.html b/uber/templates/preregistration/additional_info.html index bcf93a8a2..810dbb2a0 100644 --- a/uber/templates/preregistration/additional_info.html +++ b/uber/templates/preregistration/additional_info.html @@ -27,7 +27,7 @@ {% if is_prereg_dealer %} {% else %} - + {% endif %} {{ csrf_token() }} {% include "forms/other_info.html" %} From dbfd4361401e34b9bf4aa4558fd955f5a2263d82 Mon Sep 17 00:00:00 2001 From: Mark Murnane Date: Thu, 3 Aug 2023 21:34:22 -0400 Subject: [PATCH 2/2] Fixing typos --- uber/site_sections/preregistration.py | 2 +- uber/templates/preregistration/additional_info.html | 2 +- uber/templates/preregistration/stripeForm.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/uber/site_sections/preregistration.py b/uber/site_sections/preregistration.py index 97f22ed3e..08cbfce9f 100644 --- a/uber/site_sections/preregistration.py +++ b/uber/site_sections/preregistration.py @@ -1457,7 +1457,7 @@ def validate_dealer(self, session, form_list=[], **params): @ajax def validate_attendee(self, session, form_list=[], **params): - id = params.get('id', params.get('edit_id')) + id = params.get('id', params.get('edit_id', params.get('attendee_id'))) if id in [None, '', 'None']: attendee = Attendee() else: diff --git a/uber/templates/preregistration/additional_info.html b/uber/templates/preregistration/additional_info.html index 810dbb2a0..bcf93a8a2 100644 --- a/uber/templates/preregistration/additional_info.html +++ b/uber/templates/preregistration/additional_info.html @@ -27,7 +27,7 @@ {% if is_prereg_dealer %} {% else %} - + {% endif %} {{ csrf_token() }} {% include "forms/other_info.html" %} diff --git a/uber/templates/preregistration/stripeForm.html b/uber/templates/preregistration/stripeForm.html index 81e19d065..d469b5a1b 100644 --- a/uber/templates/preregistration/stripeForm.html +++ b/uber/templates/preregistration/stripeForm.html @@ -288,7 +288,7 @@ {% else %} var collectStripePayment = function (client_secret, stripe_id, success_url, cancel_url) { var stripeModal = bootstrap.Modal.getOrCreateInstance($('#stripeModal')); - sripeModal.show(); + stripeModal.show(); $("#cc-message-alert").hide().removeClass().addClass("alert").children("span").html(""); var form = document.getElementById('payment-form'); var stripe = Stripe('{{ c.STRIPE_PUBLIC_KEY }}');