From 568d8744768dd9f3e7989b04c1c4f43750801e57 Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 17 Dec 2019 23:32:49 +0530 Subject: [PATCH] Add initial value for the vat_number field in the settings --- hosting/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hosting/views.py b/hosting/views.py index b81c5ea3..c2a6cb0a 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -538,9 +538,12 @@ class SettingsView(LoginRequiredMixin, FormView): Check if the user already saved contact details. If so, then show the form populated with those details, to let user change them. """ - return form_class( + + bill_form = form_class( instance=self.request.user.billing_addresses.first(), **self.get_form_kwargs()) + bill_form.fields['vat_number'].initial = self.request.user.vat_number + return bill_form def get_context_data(self, **kwargs): context = super(SettingsView, self).get_context_data(**kwargs)