|
|
|
|
@ -177,10 +177,13 @@ class CourseView(DetailView): |
|
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
|
|
response = super().get(request, *args, **kwargs) |
|
|
|
|
if (self.object.status != Course.PUBLISHED and request.user.role != User.ADMIN_ROLE) or (self.object.status != Course.PUBLISHED and request.user.role != User.AUTHOR_ROLE and self.object.author != request.user): |
|
|
|
|
if (not request.user.is_authenticated and self.object.status != Course.PUBLISHED): |
|
|
|
|
raise Http404 |
|
|
|
|
return response |
|
|
|
|
|
|
|
|
|
# ((self.object.status != Course.PUBLISHED and request.user.role != User.ADMIN_ROLE) or |
|
|
|
|
# (self.object.status != Course.PUBLISHED and request.user.role != User.AUTHOR_ROLE and self.object.author != request.user)): |
|
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
|
context = super().get_context_data(**kwargs) |
|
|
|
|
context['next'] = self.request.GET.get('next', None) |
|
|
|
|
|