|
|
|
|
@ -55,11 +55,11 @@ class ProfileView(TemplateView): |
|
|
|
|
def get_context_data(self, object): |
|
|
|
|
context = super().get_context_data() |
|
|
|
|
context['user'] = self.request.user |
|
|
|
|
context['is_author'] = self.request.user.role == User.AUTHOR_ROLE |
|
|
|
|
|
|
|
|
|
context['published'] = Course.objects.filter( |
|
|
|
|
author=self.object, |
|
|
|
|
) |
|
|
|
|
context['is_author'] = context['published'] or self.request.user.role == User.AUTHOR_ROLE |
|
|
|
|
context['paid'] = Course.objects.filter( |
|
|
|
|
payments__in=CoursePayment.objects.filter( |
|
|
|
|
user=self.object, |
|
|
|
|
@ -103,7 +103,7 @@ class UserView(DetailView): |
|
|
|
|
def get_context_data(self, object): |
|
|
|
|
context = super().get_context_data() |
|
|
|
|
context['published'] = Course.objects.filter( |
|
|
|
|
author=self.object, |
|
|
|
|
author=self.object, status=Course.PUBLISHED, |
|
|
|
|
) |
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|