Add initial values for dcl billing form
This commit is contained in:
parent
fcda0b5637
commit
0202d5ba93
2 changed files with 2 additions and 12 deletions
|
@ -349,8 +349,9 @@ class PaymentOrderView(FormView):
|
||||||
'instance': self.request.user.billing_addresses.first()
|
'instance': self.request.user.billing_addresses.first()
|
||||||
})
|
})
|
||||||
if 'billing_address_data' in self.request.session:
|
if 'billing_address_data' in self.request.session:
|
||||||
|
billing_address_data = self.request.session['billing_address_data']
|
||||||
form_kwargs.update({
|
form_kwargs.update({
|
||||||
'billing_address_data': self.request.session['billing_address_data']
|
'initial': billing_address_data
|
||||||
})
|
})
|
||||||
return form_kwargs
|
return form_kwargs
|
||||||
|
|
||||||
|
|
|
@ -118,12 +118,6 @@ class EditCreditCardForm(forms.Form):
|
||||||
class BillingAddressForm(forms.ModelForm):
|
class BillingAddressForm(forms.ModelForm):
|
||||||
token = forms.CharField(widget=forms.HiddenInput(), required=False)
|
token = forms.CharField(widget=forms.HiddenInput(), required=False)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
billing_address_data = kwargs.get('billing_address_data', {})
|
|
||||||
kwargs['initial'] = billing_address_data
|
|
||||||
super(BillingAddressForm, self).__init__(*args, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = BillingAddress
|
model = BillingAddress
|
||||||
fields = ['cardholder_name', 'street_address',
|
fields = ['cardholder_name', 'street_address',
|
||||||
|
@ -142,11 +136,6 @@ class BillingAddressFormSignup(BillingAddressForm):
|
||||||
email = forms.EmailField(label=_('Email Address'))
|
email = forms.EmailField(label=_('Email Address'))
|
||||||
field_order = ['name', 'email']
|
field_order = ['name', 'email']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
billing_address_data = kwargs.get('billing_address_data', {})
|
|
||||||
kwargs['initial'] = billing_address_data
|
|
||||||
super(BillingAddressFormSignup, self).__init__(*args, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class UserBillingAddressForm(forms.ModelForm):
|
class UserBillingAddressForm(forms.ModelForm):
|
||||||
user = forms.ModelChoiceField(queryset=CustomUser.objects.all(),
|
user = forms.ModelChoiceField(queryset=CustomUser.objects.all(),
|
||||||
|
|
Loading…
Reference in a new issue