use timezone aware datetime

This commit is contained in:
Serghei Mihai 2016-05-18 18:38:03 +02:00
parent 23131faba1
commit 090b8f3c9e
1 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ from hashlib import sha256
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from django.utils.timezone import make_aware, get_current_timezone
from django.utils import timezone
from django.db.models import Q
from django.template.loader import get_template
from django.template import Context
@ -75,7 +75,7 @@ class Command(BaseCommand):
for invoice in queryset:
try:
notification = InvoiceNotificationEmail.objects.filter(invoice_number=invoice.id).latest()
if notification.date_sent > make_aware(datetime.now(), get_current_timezone()) - timedelta(days=notification_timeout):
if notification.date_sent > timezone.now() - timedelta(days=notification_timeout):
continue
if invoice.solde == 0:
continue