From b1566c4c61605ff5f9122af6a00d10ebfb2b2dfd Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 3 Apr 2019 06:22:49 +0200 Subject: [PATCH] Get the last monthly hosting bill --- hosting/management/commands/fetch_stripe_bills.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hosting/management/commands/fetch_stripe_bills.py b/hosting/management/commands/fetch_stripe_bills.py index 6285ec0a..fb4718c7 100644 --- a/hosting/management/commands/fetch_stripe_bills.py +++ b/hosting/management/commands/fetch_stripe_bills.py @@ -24,9 +24,8 @@ class Command(BaseCommand): if hasattr(user, 'stripecustomer'): self.stdout.write(self.style.SUCCESS( 'Found %s. Fetching bills for him.' % email)) - mhb = MonthlyHostingBill.objects.last( - customer=user.stripecustomer - ) + mhb = MonthlyHostingBill.objects.filter( + customer=user.stripecustomer).last() created_gt = {} if mhb is not None: # fetch only invoices which is created after