diff options
author | adityacp | 2020-03-31 15:51:15 +0530 |
---|---|---|
committer | adityacp | 2020-03-31 15:51:15 +0530 |
commit | e6cce5b0ca4d616b7ff55c66f5d94376974fcc4c (patch) | |
tree | 7fe82f35e3fc1fe754494a5af61f4969f0d63f1d /yaksh/views.py | |
parent | 541f3ec154f7c484a2a9105565117cefa4e15b18 (diff) | |
download | online_test-e6cce5b0ca4d616b7ff55c66f5d94376974fcc4c.tar.gz online_test-e6cce5b0ca4d616b7ff55c66f5d94376974fcc4c.tar.bz2 online_test-e6cce5b0ca4d616b7ff55c66f5d94376974fcc4c.zip |
Change course_modules.html and views.py
- Get distinct courses in student dashboard
- Add condition to check if question paper exists for a quiz in course modules
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 15 |
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: |