Files
@ ce4ae22fa59e
Branch filter:
Location: website/conservancy/supporters/forms.py - annotation
ce4ae22fa59e
863 B
text/x-python
Add prototype monthly recurring payment via Stripe
26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 ce4ae22fa59e ce4ae22fa59e 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 26a6928a2046 ce4ae22fa59e ce4ae22fa59e 26a6928a2046 | from django import forms
from .models import SustainerOrder
class SustainerForm(forms.ModelForm):
amount_monthly = forms.IntegerField(initial=12, required=False)
class Meta:
model = SustainerOrder
fields = [
'name',
'email',
'amount',
'acknowledge_publicly',
'add_to_mailing_list',
'tshirt_size',
'street',
'city',
'state',
'zip_code',
'country',
]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['amount'].widget.attrs['style'] = 'width: 5rem'
self.fields['amount'].initial = 128
self.fields['amount_monthly'].widget.attrs['style'] = 'width: 5rem'
self.fields['tshirt_size'].widget.attrs['x-model'] = 'tshirt_size'
|