|
|
|
|
@ -24,7 +24,8 @@ from apps.config.models import Config |
|
|
|
|
from apps.course.models import Course |
|
|
|
|
from apps.notification.utils import send_email |
|
|
|
|
from apps.school.models import SchoolSchedule |
|
|
|
|
from apps.payment.models import AuthorBalance, CoursePayment, SchoolPayment, Payment, UserGiftCertificate, UserBonus |
|
|
|
|
from apps.payment.models import AuthorBalance, CoursePayment, SchoolPayment, Payment, UserGiftCertificate, UserBonus, \ |
|
|
|
|
DrawingCampPayment |
|
|
|
|
from apps.user.models import AuthorRequest, EmailSubscription, SubscriptionCategory |
|
|
|
|
|
|
|
|
|
from .forms import AuthorRequesForm, UserEditForm, WithdrawalForm |
|
|
|
|
@ -90,6 +91,17 @@ class ProfileView(TemplateView): |
|
|
|
|
context['school_purchased_price'] = aggregated.get('amount__sum') or 0 |
|
|
|
|
context['school_purchased_dates'] = [aggregated.get('date_start__min'), aggregated.get('date_end__max')] |
|
|
|
|
|
|
|
|
|
camp_payment = DrawingCampPayment.objects.filter( |
|
|
|
|
user=self.object, |
|
|
|
|
date_end__gte=now(), |
|
|
|
|
status__in=DrawingCampPayment.PW_PAID_STATUSES, |
|
|
|
|
) |
|
|
|
|
context['is_camp_purchased'] = camp_payment.exists() |
|
|
|
|
if context['is_camp_purchased']: |
|
|
|
|
aggregated = camp_payment.aggregate(Sum('amount'), Min('date_start'), Max('date_end'),) |
|
|
|
|
context['camp_purchased_price'] = aggregated.get('amount__sum') or 0 |
|
|
|
|
context['camp_purchased_dates'] = [aggregated.get('date_start__min'), aggregated.get('date_end__max')] |
|
|
|
|
|
|
|
|
|
context['profile'] = True |
|
|
|
|
|
|
|
|
|
return context |
|
|
|
|
|