26 lines
674 B
Python
26 lines
674 B
Python
|
from django import forms
|
||
|
|
||
|
from .models import SustainerOrder
|
||
|
|
||
|
class SustainerForm(forms.ModelForm):
|
||
|
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['tshirt_size'].widget.attrs['x-model'] = 'tshirt_size'
|