Check if user has stripecustomer attr

This commit is contained in:
PCoder 2019-04-06 14:07:26 +02:00
parent 92b2504f1e
commit 8c04acaff8

View file

@ -85,9 +85,11 @@ class DashboardView(LoginRequiredMixin, View):
context = self.get_context_data() context = self.get_context_data()
context['has_invoices'] = False context['has_invoices'] = False
try: try:
bills = MonthlyHostingBill.objects.filter( bills = []
customer=self.request.user.stripecustomer if hasattr(self.request.user, 'stripecustomer'):
) bills = MonthlyHostingBill.objects.filter(
customer=self.request.user.stripecustomer
)
if len(bills) > 0: if len(bills) > 0:
context['has_invoices'] = True context['has_invoices'] = True
except MonthlyHostingBill.DoesNotExist as dne: except MonthlyHostingBill.DoesNotExist as dne: