Template
Populate the client website template with catalog feature flags.
Extract always-on public/portal/UTM plus optional email_sms, directmail, blog, payments, social, and social_ai so new client sites can be bootstrapped from this seed. Refs #1 Refs #2 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class ContactForm(forms.Form):
|
||||
INTEREST_CHOICES = [
|
||||
("general", "General inquiry"),
|
||||
("quote", "Request a quote"),
|
||||
("support", "Support"),
|
||||
("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 NotifyForm(forms.Form):
|
||||
email = forms.EmailField(
|
||||
widget=forms.EmailInput(attrs={"class": "form-input"}),
|
||||
)
|
||||
Reference in New Issue
Block a user