Commit 6a4c80a6 authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Add rule to take groups in count for courses

parent 28c20c5b
......@@ -70,7 +70,7 @@ class CourseViewSet(viewsets.ModelViewSet):
#)
from django.utils.translation import get_language
current_language = get_language()
query = Q(status='published', lang__contains=[current_language])
query = Q(Q(status='published', lang__contains=[current_language]) & Q(Q(is_public=True, ) | Q(groups__in=self.request.user.groups.all(), status='published')))
if (CourseProfessor.objects.filter(user=self.request.user, role='coordinator').exists()):
query.add(Q(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment