Template
Closes #9. Shop-gated buyer accounts, purchase reviews, Stripe customer ids, shipment tracking, slim public contact form, and a template-neutral seed_demo command.
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
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"),
|
|
]
|
|
|
|
email = forms.EmailField(
|
|
widget=forms.EmailInput(attrs={"class": "form-input", "id": "contact-email"}),
|
|
)
|
|
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"}),
|
|
)
|