generated from westfarn/web_django_template
CI / test (pull_request) Successful in 35s
Shoppers can register, save shipping details, and view order history while cards stay on Stripe. EasyPost tracker updates (including numbers from Pirate Ship) and 1–5 star reviews are limited to buyers. The contact form now only asks for email and a message.
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
from django import forms
|
|
from django.conf import settings
|
|
|
|
|
|
class ContactForm(forms.Form):
|
|
INTEREST_CHOICES = [
|
|
("general", "General inquiry"),
|
|
("custom", "Custom toy / print"),
|
|
("order", "Order question"),
|
|
("wholesale", "Wholesale"),
|
|
("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"}),
|
|
)
|