summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index 2cd09ac..c72c4ff 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -176,15 +176,14 @@ def quizlist_user(request, enrolled=None, msg=None):
courses = hidden_courses
title = 'Search Results'
else:
- courses = list(Course.objects.filter(
- active=True, is_trial=False,
+ enrolled_courses = user.students.filter(is_trial=False).order_by('-id')
+ remaining_courses = list(Course.objects.filter(
+ active=True, is_trial=False, hidden=False
).exclude(
- ~Q(requests=user), ~Q(rejected=user), hidden=True
- ).order_by('-id'))
- enrolled_course = list(
- user.students.filter(is_trial=False).order_by('-id')
- )
- courses.extend(enrolled_course)
+ id__in=enrolled_courses.values_list("id", flat=True)
+ ).order_by('-id'))
+ courses = list(enrolled_courses)
+ courses.extend(remaining_courses)
title = 'All Courses'
for course in courses: