diff --git a/billing/views.py b/billing/views.py index 20b944b2..f68ba56b 100644 --- a/billing/views.py +++ b/billing/views.py @@ -742,7 +742,7 @@ def graph_yearly_billing(request): growth.append(None) last_turnover = current_turnover - if years[-1] == date.today().year: + if years and years[-1] == date.today().year: growth.pop() # Don't compute for on-going year. graph_data.append(["x"] + years) # X (years) axis diff --git a/leads/views.py b/leads/views.py index 4f168081..9a9adddc 100644 --- a/leads/views.py +++ b/leads/views.py @@ -511,6 +511,9 @@ def graph_leads_activity(request): if subsidiary: leads = leads.filter(subsidiary=subsidiary) + if not leads: + return HttpResponse('') + # lead creation rate per week first_lead_creation_date = leads.aggregate(Min("creation_date")).get("creation_date__min", datetime.now()).date() today = date.today()