Fix error in obtaining customuser for mab
This commit is contained in:
parent
6a7b5459ce
commit
c232f4c1da
1 changed files with 9 additions and 2 deletions
|
@ -1171,9 +1171,16 @@ class InvoiceListView(LoginRequiredMixin, ListView):
|
||||||
context = super(InvoiceListView, self).get_context_data(**kwargs)
|
context = super(InvoiceListView, self).get_context_data(**kwargs)
|
||||||
if ('user_email' in self.request.GET
|
if ('user_email' in self.request.GET
|
||||||
and self.request.user.email == settings.ADMIN_EMAIL):
|
and self.request.user.email == settings.ADMIN_EMAIL):
|
||||||
mabs = MonthlyHostingBill.objects.filter(
|
user_email = self.request.GET['user_email']
|
||||||
customer__user=self.request.GET['user_email']
|
logger.debug(
|
||||||
|
"user_email = {}".format(user_email)
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
|
cu = CustomUser.objects.get(user_email)
|
||||||
|
except CustomUser.DoesNotExist as dne:
|
||||||
|
logger.debug("User does not exist")
|
||||||
|
cu = self.request.user
|
||||||
|
mabs = MonthlyHostingBill.objects.filter(customer__user=cu)
|
||||||
else:
|
else:
|
||||||
mabs = MonthlyHostingBill.objects.filter(
|
mabs = MonthlyHostingBill.objects.filter(
|
||||||
customer__user=self.request.user
|
customer__user=self.request.user
|
||||||
|
|
Loading…
Reference in a new issue