From 90c932cd039a6df7012e024b4e68e5cb5cf824ea Mon Sep 17 00:00:00 2001 From: serge Date: Tue, 11 Oct 2016 11:23:24 +0800 Subject: [PATCH] Fixed issue when creating/editing profile: the AddressForm needs a user as args. --- wildlifelicensing/apps/applications/views/entry.py | 4 ++-- wildlifelicensing/apps/customer_management/views/customer.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wildlifelicensing/apps/applications/views/entry.py b/wildlifelicensing/apps/applications/views/entry.py index 9ae4867292..96b72d0420 100755 --- a/wildlifelicensing/apps/applications/views/entry.py +++ b/wildlifelicensing/apps/applications/views/entry.py @@ -379,7 +379,7 @@ def get_context_data(self, **kwargs): initial_email=application.applicant.email, user=application.applicant) - kwargs['address_form'] = AddressForm() + kwargs['address_form'] = AddressForm(user=application.applicant) return super(CreateSelectProfileView, self).get_context_data(**kwargs) @@ -400,7 +400,7 @@ def post(self, request, *args, **kwargs): return render(request, self.template_name, {'licence_type': application.licence_type, 'profile_selection_form': profile_selection_form, 'profile_creation_form': ProfileForm(), - 'address_form': AddressForm()}) + 'address_form': AddressForm(user=application.applicant)}) elif 'create' in request.POST: profile_form = ProfileForm(request.POST) address_form = AddressForm(request.POST) diff --git a/wildlifelicensing/apps/customer_management/views/customer.py b/wildlifelicensing/apps/customer_management/views/customer.py index 6e06a63cb5..d2c3848b9a 100644 --- a/wildlifelicensing/apps/customer_management/views/customer.py +++ b/wildlifelicensing/apps/customer_management/views/customer.py @@ -248,7 +248,7 @@ def get_context_data(self, **kwargs): kwargs['address_form'] = AddressForm(instance=profile.postal_address) else: kwargs['profile_form'] = ProfileForm(user=customer) - kwargs['address_form'] = AddressForm() + kwargs['address_form'] = AddressForm(user=customer) return super(EditProfileView, self).get_context_data(**kwargs)