diff --git a/apps/payment/admin.py b/apps/payment/admin.py index b26b03a2..d502c2fe 100644 --- a/apps/payment/admin.py +++ b/apps/payment/admin.py @@ -28,11 +28,10 @@ class PaymentChildAdmin(PolymorphicChildModelAdmin): 'user', 'amount', 'status', - 'roistat_visit', 'created_at', ) base_fieldsets = ( - (None, {'fields': ('user', 'amount', 'status', 'data', 'roistat_visit',)}), + (None, {'fields': ('user', 'amount', 'status', 'data',)}), ) readonly_fields = ('amount', 'data',) diff --git a/apps/payment/models.py b/apps/payment/models.py index a216bff0..b8e2d8c1 100644 --- a/apps/payment/models.py +++ b/apps/payment/models.py @@ -115,7 +115,8 @@ class Payment(PolymorphicModel): roistat_visit = models.PositiveIntegerField('Номер визита Roistat', null=True, editable=False) created_at = models.DateTimeField(auto_now_add=True) update_at = models.DateTimeField(auto_now=True) - bonus = models.ForeignKey('payment.UserBonus', null=True, on_delete=models.SET_NULL, related_name='purchase_payments') + bonus = models.ForeignKey('payment.UserBonus', blank=True, null=True, on_delete=models.SET_NULL, + related_name='purchase_payments') objects = PaymentManger() diff --git a/apps/school/templates/drawing_camp/promo.html b/apps/school/templates/drawing_camp/promo.html index c8b747ca..d6a66c84 100644 --- a/apps/school/templates/drawing_camp/promo.html +++ b/apps/school/templates/drawing_camp/promo.html @@ -14,7 +14,7 @@ class="main__btn btn" href="#" > - {% if not is_purchased and not is_purchased_future %}Купить доступ за {{ drawing_camp_price }} руб./месяц{% endif %} + {% if not is_purchased and not is_purchased_future %}Узнать цену{% endif %} {% if is_purchased_future and not is_purchased %}ваша подписка начинается {{school_purchased_future.date_start}}{% endif %} {% if is_purchased %}ваша подписка истекает {{ subscription_ends_humanize }}
перейти к оплате{% endif %} diff --git a/apps/school/templates/drawing_camp/schedule_purchased.html b/apps/school/templates/drawing_camp/schedule_purchased.html index 6128eb6f..15b11875 100644 --- a/apps/school/templates/drawing_camp/schedule_purchased.html +++ b/apps/school/templates/drawing_camp/schedule_purchased.html @@ -8,17 +8,6 @@
Начнется через {{ next_lesson_start }}
- - {% if not is_purchased_future %} -
- Присоединиться на июль -
- {% endif %} {% endif %} diff --git a/apps/school/views.py b/apps/school/views.py index a915ea1f..ccbd16ab 100644 --- a/apps/school/views.py +++ b/apps/school/views.py @@ -336,11 +336,7 @@ class DrawingCampView(TemplateView): date_start__lte=prev_range[1], date_end__gte=prev_range[0], user=self.request.user, - status__in=[ - Pingback.PINGBACK_TYPE_REGULAR, - Pingback.PINGBACK_TYPE_GOODWILL, - Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED, - ], + status__in=DrawingCampPayment.PW_PAID_STATUSES, ) # берем все подписки, которые были в периоде 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)