Feat: Apply for Founding Partner Program page hookup fixed and hooked up to rest of app through Home page.
This commit is contained in:
@@ -32,6 +32,10 @@ import json
|
||||
from altcha import verify_solution
|
||||
import base64
|
||||
|
||||
def at_least_one_required(form, field):
|
||||
"""Validator that requires at least one checkbox to be selected"""
|
||||
if not field.data or len(field.data) == 0:
|
||||
raise ValidationError('Please select at least one option.')
|
||||
|
||||
class MultiCheckboxField(SelectMultipleField):
|
||||
widget = ListWidget(prefix_label=False)
|
||||
@@ -73,7 +77,7 @@ class Form_Apply_Founding_Partner(FlaskForm):
|
||||
]
|
||||
, validators = [DataRequired()]
|
||||
)
|
||||
id_speciality = MultiCheckboxField( # SelectMultipleField(
|
||||
ids_speciality = MultiCheckboxField( # SelectMultipleField(
|
||||
'What type(s) of training do you specialise in?'
|
||||
, choices = [
|
||||
( '1', 'Basic obedience' )
|
||||
@@ -85,9 +89,9 @@ class Form_Apply_Founding_Partner(FlaskForm):
|
||||
, ( '7', 'One-on-one sessions' )
|
||||
, ( '8', 'Other (specify below)' )
|
||||
]
|
||||
, validators = [DataRequired()]
|
||||
, validators = [at_least_one_required]
|
||||
)
|
||||
id_existing_system = MultiCheckboxField( # SelectMultipleField(
|
||||
ids_existing_system = MultiCheckboxField( # SelectMultipleField(
|
||||
'How do you currently manage client information and training records?'
|
||||
, choices = [
|
||||
( '1', 'Spreadsheets (Excel/Google Sheets)' )
|
||||
@@ -97,7 +101,7 @@ class Form_Apply_Founding_Partner(FlaskForm):
|
||||
, ( '5', 'Mostly in my head/memory' )
|
||||
, ( '6', 'Other (specify below)' )
|
||||
]
|
||||
, validators = [DataRequired()]
|
||||
, validators = [at_least_one_required]
|
||||
)
|
||||
existing_challenges = TextAreaField(
|
||||
"What's your biggest frustration with your current system?"
|
||||
@@ -157,8 +161,8 @@ class Form_Apply_Founding_Partner(FlaskForm):
|
||||
, Base.FLAG_WEBSITE: self.website.data
|
||||
, Apply_Founding_Partner_Form.FLAG_DOG_COUNT: self.dog_count.data
|
||||
, Apply_Founding_Partner_Form.FLAG_YEARS_OF_EXPERIENCE: self.id_years_of_experience.data
|
||||
, Apply_Founding_Partner_Form.FLAG_SPECIALITY: self.id_speciality.data
|
||||
, Apply_Founding_Partner_Form.FLAG_EXISTING_SYSTEM: self.id_existing_system.data
|
||||
, Apply_Founding_Partner_Form.FLAG_SPECIALITY: ','.join(self.ids_speciality.data)
|
||||
, Apply_Founding_Partner_Form.FLAG_EXISTING_SYSTEM: ','.join(self.ids_existing_system.data)
|
||||
, Apply_Founding_Partner_Form.FLAG_EXISTING_CHALLENGES: self.existing_challenges.data
|
||||
, Apply_Founding_Partner_Form.FLAG_EXISTING_TIME_SINK_WEEKLY: self.id_existing_time_sink_weekly.data
|
||||
, Apply_Founding_Partner_Form.FLAG_COMMITMENT_FREQUENCY: self.id_commitment_frequency.data
|
||||
|
||||
@@ -36,8 +36,6 @@ class AltchaValidator:
|
||||
def __call__(self, form, field):
|
||||
altcha_data = field.data
|
||||
|
||||
return True
|
||||
|
||||
if not altcha_data:
|
||||
raise ValidationError(self.message)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user