From 6a93716bef98f23a25c13a8254bd7ba1cf4bb82e Mon Sep 17 00:00:00 2001 From: nikita Date: Wed, 5 Sep 2018 00:27:36 +0300 Subject: [PATCH] Future code removed --- apps/school/views.py | 20 ++------------------ apps/user/views.py | 10 ++-------- project/views.py | 15 ++------------- 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/apps/school/views.py b/apps/school/views.py index e09801c2..3816c0eb 100644 --- a/apps/school/views.py +++ b/apps/school/views.py @@ -167,27 +167,11 @@ class SchoolView(TemplateView): ) school_payment_exists = school_payment.exists() - school_payment_future = SchoolPayment.objects.filter( - user=self.request.user, - status__in=[ - Pingback.PINGBACK_TYPE_REGULAR, - Pingback.PINGBACK_TYPE_GOODWILL, - Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED, - ], - date_start__gte=date_now, - date_end__gte=date_now - ) - - school_payment_exists_future = school_payment_future.exists() - school_purchased_future = school_payment_future.last() - school_schedules_purchased = school_payment.annotate( joined_weekdays=Func(F('weekdays'), function='unnest',) ).values_list('joined_weekdays', flat=True).distinct() else: school_payment_exists = False - school_payment_exists_future = False - school_purchased_future = False school_schedules_purchased = [] if all_schedules_purchased and is_previous: live_lessons = LiveLesson.objects.filter( @@ -208,11 +192,11 @@ class SchoolView(TemplateView): 'is_previous': is_previous, 'course_items': Course.objects.filter(status=Course.PUBLISHED)[:6], 'is_purchased': school_payment_exists, - 'is_purchased_future': school_payment_exists_future, + 'is_purchased_future': False, 'min_school_price': SchoolSchedule.objects.aggregate(Min('month_price'))['month_price__min'], 'school_schedules': school_schedules, 'school_schedules_purchased': school_schedules_purchased, - 'school_purchased_future': school_purchased_future, + 'school_purchased_future': False, 'subscription_ends': school_payment.filter(add_days=False).first().date_end if school_payment_exists else None, }) return context diff --git a/apps/user/views.py b/apps/user/views.py index 4f2d424e..41a18cb0 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -94,14 +94,8 @@ class ProfileView(TemplateView): ).all() context['all_school_schedules'] = SchoolSchedule.objects.all() - school_payment_future = SchoolPayment.objects.filter( - user=self.object, - date_start__gte=now(), - date_end__gte=now() - ) - - context['is_purchased_future'] = school_payment_future.exists() - context['school_purchased_future'] = school_payment_future.last() + context['is_purchased_future'] = False + context['school_purchased_future'] = False return context diff --git a/project/views.py b/project/views.py index a22a8499..e2df9f42 100644 --- a/project/views.py +++ b/project/views.py @@ -60,19 +60,8 @@ class IndexView(TemplateView): joined_weekdays=Func(F('weekdays'), function='unnest',) ).values_list('joined_weekdays', flat=True).distinct() - school_payment_future = SchoolPayment.objects.filter( - user=self.request.user, - date_start__gte=date_now, - date_end__gte=date_now - ) - - school_payment_exists_future = school_payment_future.exists() - school_purchased_future = school_payment_future.last() - else: school_payment_exists = False - school_payment_exists_future = False - school_purchased_future = False school_schedules_purchased = [] context.update({ @@ -88,8 +77,8 @@ class IndexView(TemplateView): 'subscription_ends': school_payment.filter(add_days=False).first().date_end if school_payment_exists else None, 'subscription_ends_humanize': school_payment.filter(add_days=False).first().date_end_humanize if school_payment_exists else None, - 'school_purchased_future': school_purchased_future, - 'is_purchased_future': school_payment_exists_future, + 'school_purchased_future': False, + 'is_purchased_future': False, }) return context