generated from westfarn/web_django_template
Replaces template branding with College Craft pages, assets, and copy, and matches Gitea deploy workflows to the server-infra catalog name and master branch so beta deploys actually run. Closes #1
245 lines
7.3 KiB
Python
245 lines
7.3 KiB
Python
from django import forms
|
|
from django.conf import settings
|
|
|
|
|
|
class ContactForm(forms.Form):
|
|
INTEREST_CHOICES = [
|
|
("quote", "Free estimate"),
|
|
("interior", "Interior painting"),
|
|
("exterior", "Exterior painting"),
|
|
("commercial", "Commercial / multi-family"),
|
|
("deck", "Deck staining & power washing"),
|
|
("other", "Something else"),
|
|
]
|
|
|
|
first_name = forms.CharField(
|
|
max_length=100,
|
|
widget=forms.TextInput(attrs={"class": "form-input", "id": "contact-first-name"}),
|
|
)
|
|
last_name = forms.CharField(
|
|
max_length=100,
|
|
required=False,
|
|
widget=forms.TextInput(attrs={"class": "form-input", "id": "contact-last-name"}),
|
|
)
|
|
email = forms.EmailField(
|
|
widget=forms.EmailInput(attrs={"class": "form-input", "id": "contact-email"}),
|
|
)
|
|
phone = forms.CharField(
|
|
max_length=32,
|
|
required=False,
|
|
widget=forms.TextInput(attrs={"class": "form-input", "id": "contact-phone"}),
|
|
)
|
|
address_line1 = forms.CharField(
|
|
max_length=200,
|
|
required=False,
|
|
label="Street address",
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-input",
|
|
"id": "contact-address-line1",
|
|
"autocomplete": "off",
|
|
"data-ac": "line1",
|
|
}
|
|
),
|
|
)
|
|
address_line2 = forms.CharField(
|
|
max_length=200,
|
|
required=False,
|
|
label="Apt / suite",
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-input",
|
|
"id": "contact-address-line2",
|
|
"autocomplete": "address-line2",
|
|
"data-ac": "line2",
|
|
}
|
|
),
|
|
)
|
|
address_city = forms.CharField(
|
|
max_length=100,
|
|
required=False,
|
|
label="City",
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-input",
|
|
"id": "contact-address-city",
|
|
"autocomplete": "address-level2",
|
|
"data-ac": "city",
|
|
}
|
|
),
|
|
)
|
|
address_state = forms.CharField(
|
|
max_length=32,
|
|
required=False,
|
|
label="State",
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-input",
|
|
"id": "contact-address-state",
|
|
"autocomplete": "address-level1",
|
|
"data-ac": "state",
|
|
}
|
|
),
|
|
)
|
|
address_zip = forms.CharField(
|
|
max_length=20,
|
|
required=False,
|
|
label="ZIP",
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-input",
|
|
"id": "contact-address-zip",
|
|
"autocomplete": "postal-code",
|
|
"data-ac": "zip",
|
|
}
|
|
),
|
|
)
|
|
interest = forms.ChoiceField(
|
|
choices=INTEREST_CHOICES,
|
|
widget=forms.Select(attrs={"class": "form-input", "id": "contact-interest"}),
|
|
)
|
|
message = forms.CharField(
|
|
widget=forms.Textarea(attrs={"class": "form-input", "id": "contact-message"}),
|
|
)
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
if settings.RECAPTCHA_PUBLIC_KEY and settings.RECAPTCHA_PRIVATE_KEY:
|
|
from django_recaptcha.fields import ReCaptchaField
|
|
from django_recaptcha.widgets import ReCaptchaV3
|
|
|
|
self.fields["captcha"] = ReCaptchaField(widget=ReCaptchaV3)
|
|
|
|
|
|
class CareersForm(forms.Form):
|
|
POSITION_CHOICES = [
|
|
("foreman", "Job Foreman"),
|
|
("painter", "Painter"),
|
|
("sales", "Sales"),
|
|
("subcontractor", "Sub-Contractor"),
|
|
]
|
|
YES_NO = [("yes", "Yes"), ("no", "No")]
|
|
|
|
first_name = forms.CharField(
|
|
max_length=100,
|
|
widget=forms.TextInput(attrs={"class": "form-input", "id": "careers-first-name"}),
|
|
)
|
|
last_name = forms.CharField(
|
|
max_length=100,
|
|
required=False,
|
|
widget=forms.TextInput(attrs={"class": "form-input", "id": "careers-last-name"}),
|
|
)
|
|
email = forms.EmailField(
|
|
widget=forms.EmailInput(attrs={"class": "form-input", "id": "careers-email"}),
|
|
)
|
|
phone = forms.CharField(
|
|
max_length=32,
|
|
required=False,
|
|
widget=forms.TextInput(attrs={"class": "form-input", "id": "careers-phone"}),
|
|
)
|
|
address_line1 = forms.CharField(
|
|
max_length=200,
|
|
required=False,
|
|
label="Street address",
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-input",
|
|
"id": "careers-address-line1",
|
|
"autocomplete": "off",
|
|
"data-ac": "line1",
|
|
}
|
|
),
|
|
)
|
|
address_line2 = forms.CharField(
|
|
max_length=200,
|
|
required=False,
|
|
label="Apt / suite",
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-input",
|
|
"id": "careers-address-line2",
|
|
"autocomplete": "address-line2",
|
|
"data-ac": "line2",
|
|
}
|
|
),
|
|
)
|
|
address_city = forms.CharField(
|
|
max_length=100,
|
|
required=False,
|
|
label="City",
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-input",
|
|
"id": "careers-address-city",
|
|
"autocomplete": "address-level2",
|
|
"data-ac": "city",
|
|
}
|
|
),
|
|
)
|
|
address_state = forms.CharField(
|
|
max_length=32,
|
|
required=False,
|
|
label="State",
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-input",
|
|
"id": "careers-address-state",
|
|
"autocomplete": "address-level1",
|
|
"data-ac": "state",
|
|
}
|
|
),
|
|
)
|
|
address_zip = forms.CharField(
|
|
max_length=20,
|
|
required=False,
|
|
label="ZIP",
|
|
widget=forms.TextInput(
|
|
attrs={
|
|
"class": "form-input",
|
|
"id": "careers-address-zip",
|
|
"autocomplete": "postal-code",
|
|
"data-ac": "zip",
|
|
}
|
|
),
|
|
)
|
|
positions = forms.MultipleChoiceField(
|
|
choices=POSITION_CHOICES,
|
|
widget=forms.CheckboxSelectMultiple,
|
|
)
|
|
qualifications = forms.CharField(
|
|
label="Work history & qualifications",
|
|
widget=forms.Textarea(
|
|
attrs={"class": "form-input", "id": "careers-qualifications", "rows": 6}
|
|
),
|
|
)
|
|
start_date = forms.CharField(
|
|
max_length=120,
|
|
required=False,
|
|
label="When can you start?",
|
|
widget=forms.TextInput(attrs={"class": "form-input", "id": "careers-start"}),
|
|
)
|
|
drivers_license = forms.ChoiceField(
|
|
choices=YES_NO,
|
|
widget=forms.RadioSelect,
|
|
label="Do you have a valid driver's license?",
|
|
)
|
|
has_vehicle = forms.ChoiceField(
|
|
choices=YES_NO,
|
|
widget=forms.RadioSelect,
|
|
label="Do you have transportation to the job site?",
|
|
)
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
if settings.RECAPTCHA_PUBLIC_KEY and settings.RECAPTCHA_PRIVATE_KEY:
|
|
from django_recaptcha.fields import ReCaptchaField
|
|
from django_recaptcha.widgets import ReCaptchaV3
|
|
|
|
self.fields["captcha"] = ReCaptchaField(widget=ReCaptchaV3)
|
|
|
|
|
|
class NotifyForm(forms.Form):
|
|
email = forms.EmailField(
|
|
widget=forms.EmailInput(attrs={"class": "form-input"}),
|
|
)
|