|
|
|
@ -56,14 +56,17 @@ class UserView(DetailView): |
|
|
|
else: |
|
|
|
else: |
|
|
|
context['simple_user'] = True |
|
|
|
context['simple_user'] = True |
|
|
|
context['guest'] = True |
|
|
|
context['guest'] = True |
|
|
|
context['owner'] = self.request.user.id == self.object.id |
|
|
|
owner = self.request.user.id == self.object.id |
|
|
|
|
|
|
|
|
|
|
|
if context['guest'] and self.object.role <= User.USER_ROLE: |
|
|
|
if context['guest'] and self.object.role <= User.USER_ROLE: |
|
|
|
raise Http404() |
|
|
|
raise Http404() |
|
|
|
|
|
|
|
|
|
|
|
context['published'] = Course.objects.filter( |
|
|
|
published = Course.objects.filter( |
|
|
|
author=self.object, |
|
|
|
author=self.object, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
if not owner: |
|
|
|
|
|
|
|
published = published.filter(status=Course.PUBLISHED) |
|
|
|
|
|
|
|
else: |
|
|
|
context['paid'] = Course.objects.filter( |
|
|
|
context['paid'] = Course.objects.filter( |
|
|
|
payments__in=CoursePayment.objects.filter( |
|
|
|
payments__in=CoursePayment.objects.filter( |
|
|
|
user=self.object, |
|
|
|
user=self.object, |
|
|
|
@ -107,6 +110,9 @@ class UserView(DetailView): |
|
|
|
context['is_purchased_future'] = school_payment_future.exists() |
|
|
|
context['is_purchased_future'] = school_payment_future.exists() |
|
|
|
context['school_purchased_future'] = school_payment_future.last() |
|
|
|
context['school_purchased_future'] = school_payment_future.last() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context['owner'] = owner |
|
|
|
|
|
|
|
context['published'] = published |
|
|
|
|
|
|
|
|
|
|
|
return context |
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|