Get the last user billing address as the default address

This commit is contained in:
PCoder 2019-12-31 22:52:24 +05:30
parent 7423a80670
commit 6ac6db8212

View file

@ -621,6 +621,7 @@ class SettingsView(LoginRequiredMixin, FormView):
form = self.get_form() form = self.get_form()
if form.is_valid(): if form.is_valid():
if 'billing-form' in request.POST: if 'billing-form' in request.POST:
current_billing_address = self.request.user.billing_addresses.last()
billing_address_data = form.cleaned_data billing_address_data = form.cleaned_data
billing_address_data.update({ billing_address_data.update({
'user': self.request.user.id 'user': self.request.user.id