From ecda8f8eb6213683db26a32e3e7267aa298a05a0 Mon Sep 17 00:00:00 2001 From: gzbender Date: Mon, 1 Jul 2019 16:34:15 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B5=20=D0=BD=D0=B0=D1=87=D0=B8=D1=81?= =?UTF-8?q?=D0=BB=D1=8F=D1=8E=D1=82=D1=81=D1=8F=20=D0=B1=D0=BE=D0=BD=D1=83?= =?UTF-8?q?=D1=81=D1=8B=20=D0=B7=D0=B0=20=D0=B2=D1=82=D0=BE=D1=80=D1=83?= =?UTF-8?q?=D1=8E=20=D0=BF=D0=BE=D0=BA=D1=83=D0=BF=D0=BF=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/user/models.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/user/models.py b/apps/user/models.py index 11cb5c2d..4ae7e2f8 100644 --- a/apps/user/models.py +++ b/apps/user/models.py @@ -151,11 +151,12 @@ class User(AbstractUser): @property def paid_one_more(self): - from apps.payment.models import SchoolPayment, CoursePayment, Payment - school_payments_cnt = SchoolPayment.objects.filter(status__in=Payment.PW_PAID_STATUSES, user=self, + from apps.payment.models import SchoolPayment, CoursePayment, Payment, DrawingCampPayment + payments_cnt = SchoolPayment.objects.filter(status__in=Payment.PW_PAID_STATUSES, user=self, add_days=False).count() - course_payment_cnt = CoursePayment.objects.filter(status__in=Payment.PW_PAID_STATUSES, user=self).count() - return school_payments_cnt > 1 or course_payment_cnt > 1 or (school_payments_cnt and course_payment_cnt) + payments_cnt += CoursePayment.objects.filter(status__in=Payment.PW_PAID_STATUSES, user=self).count() + payments_cnt += DrawingCampPayment.objects.filter(status__in=Payment.PW_PAID_STATUSES, user=self).count() + return payments_cnt > 1 @receiver(post_save, sender=User)