Show settings view for admin
This commit is contained in:
parent
2e335fc574
commit
7afa9d2f4c
1 changed files with 11 additions and 2 deletions
|
@ -554,13 +554,22 @@ class SettingsView(LoginRequiredMixin, FormView):
|
||||||
Check if the user already saved contact details. If so, then show
|
Check if the user already saved contact details. If so, then show
|
||||||
the form populated with those details, to let user change them.
|
the form populated with those details, to let user change them.
|
||||||
"""
|
"""
|
||||||
|
username = self.request.GET.get('username')
|
||||||
|
if self.request.user.is_admin and username:
|
||||||
|
user = CustomUser.objects.get(username=username)
|
||||||
|
else:
|
||||||
|
user = self.request.user
|
||||||
return form_class(
|
return form_class(
|
||||||
instance=self.request.user.billing_addresses.first(),
|
instance=user.billing_addresses.first(),
|
||||||
**self.get_form_kwargs())
|
**self.get_form_kwargs())
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(SettingsView, self).get_context_data(**kwargs)
|
context = super(SettingsView, self).get_context_data(**kwargs)
|
||||||
# Get user
|
# Get user
|
||||||
|
username = self.request.GET.get('username')
|
||||||
|
if self.request.user.is_admin and username:
|
||||||
|
user = CustomUser.objects.get(username=username)
|
||||||
|
else:
|
||||||
user = self.request.user
|
user = self.request.user
|
||||||
stripe_customer = None
|
stripe_customer = None
|
||||||
if hasattr(user, 'stripecustomer'):
|
if hasattr(user, 'stripecustomer'):
|
||||||
|
|
Loading…
Reference in a new issue