From 7de873ce27265a56b02c117f46362d7187cc4fa2 Mon Sep 17 00:00:00 2001 From: artunit Date: Tue, 23 Dec 2008 03:30:34 +0000 Subject: [PATCH] git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@87 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- conifer/syrup/views.py | 21 +++++++++++++-------- conifer/templates/search_results.xhtml | 4 ++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/conifer/syrup/views.py b/conifer/syrup/views.py index 2d01cd8..c8668c3 100644 --- a/conifer/syrup/views.py +++ b/conifer/syrup/views.py @@ -181,24 +181,29 @@ def search(request): #course search course_query = get_query(query_string, ['title', 'department__name']) - course_list = models.Course.objects.filter(course_query).filter(active=True).order_by('title')[0:5] + course_results = models.Course.objects.filter(course_query).filter(active=True) + # course_list = models.Course.objects.filter(course_query).filter(active=True).order_by('title')[0:5] + course_list = course_results.order_by('title')[0:5] #there might be a better way of doing this, though instr and course tables should not be expensive to query #len directly on course_list will reflect limit - course_len = len(models.Course.objects.filter(course_query).filter(active=True)) + course_len = len(course_results) #instructor search instr_query = get_query(query_string, ['user__last_name']) - instructor_list = models.Member.objects.filter(instr_query).filter(role='INSTR').order_by('user__last_name')[0:5] - instr_len = len(models.Member.objects.filter(instr_query).filter(role='INSTR')) + instructor_results = models.Member.objects.filter(instr_query).filter(role='INSTR') + instructor_list = instructor_results.order_by('user__last_name')[0:5] + instr_len = len(instructor_results) else: results_list = models.Item.objects.order_by('-date_created') results_len = len(results_list) paginator = Paginator( results_list, count) - course_list = models.Course.objects.filter(active=True).order_by('title')[0:5] - course_len = len(models.Course.objects.filter(active=True)) - instructor_list = models.Member.objects.filter(role='INSTR').order_by('user__last_name')[0:5] - instr_len = len(models.Member.objects.filter(role='INSTR')) + course_results = models.Course.objects.filter(active=True) + course_list = course_results.order_by('title')[0:5] + course_len = len(course_results) + instructor_results = models.Member.objects.filter(role='INSTR') + instructor_list = instructor_results.order_by('user__last_name')[0:5] + instr_len = len(instructor_results) #info for debugging ''' diff --git a/conifer/templates/search_results.xhtml b/conifer/templates/search_results.xhtml index 99a4a77..da28d49 100644 --- a/conifer/templates/search_results.xhtml +++ b/conifer/templates/search_results.xhtml @@ -38,6 +38,10 @@ courses = course_list ${Markup(instructor.instr_name_hl(norm_query))} foo + + + (more...) + -- 2.11.0