From 8c04acaff8431e2140054f3864d7f10d583803ce Mon Sep 17 00:00:00 2001 From: PCoder Date: Sat, 6 Apr 2019 14:07:26 +0200 Subject: [PATCH] Check if user has stripecustomer attr --- hosting/views.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hosting/views.py b/hosting/views.py index c031a623..484cbe32 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -85,9 +85,11 @@ class DashboardView(LoginRequiredMixin, View): context = self.get_context_data() context['has_invoices'] = False try: - bills = MonthlyHostingBill.objects.filter( - customer=self.request.user.stripecustomer - ) + bills = [] + if hasattr(self.request.user, 'stripecustomer'): + bills = MonthlyHostingBill.objects.filter( + customer=self.request.user.stripecustomer + ) if len(bills) > 0: context['has_invoices'] = True except MonthlyHostingBill.DoesNotExist as dne: