From c842b52f1932fbea8c2ee0c31c82d7bc550ef7df Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 24 Apr 2017 23:45:54 +0300 Subject: [PATCH] license: better ending license selection --- project/customer/context_processors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/customer/context_processors.py b/project/customer/context_processors.py index db8b58a..8f029cc 100644 --- a/project/customer/context_processors.py +++ b/project/customer/context_processors.py @@ -47,7 +47,7 @@ def license_check_soon_ends(request): if not license_cookie: if license_15days is None: ending_license = (License.objects - .filter(company=request.user.profile, date_from__lte=now_, + .filter(company=request.user.profile, date_from__lte=now_, date_to__gte=now_, date_to__lte = now_ + timedelta(days=consts.LICENSE_DAYS_BEFORE_EXPIRE), deleted=False) .filter(Q(status__in = [consts.LICENSE_INACTIVE, consts.LICENSE_ACTIVE]) | Q(order_status=consts.ORDER_PAID))[:1] # ближайшая лицензия )