[open-ils-commits] r79 - servres/trunk/conifer/syrup

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Dec 16 13:19:43 EST 2008


Author: artunit
Date: 2008-12-16 13:19:41 -0500 (Tue, 16 Dec 2008)
New Revision: 79

Modified:
   servres/trunk/conifer/syrup/views.py
Log:


Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py	2008-12-09 03:05:17 UTC (rev 78)
+++ servres/trunk/conifer/syrup/views.py	2008-12-16 18:19:41 UTC (rev 79)
@@ -149,8 +149,9 @@
 #------------------------------------------------------------
 
 def search(request):
-    ''' Need to work on this
-    
+    ''' Need to work on this, the basic idea is
+        - put an entry point for instructor and course listings
+        - page through item entries
     '''
     query_string = ''
     found_entries = None
@@ -159,10 +160,16 @@
     if ('q' in request.GET) and request.GET['q'].strip():
         query_string = request.GET['q']
         norm_query = normalize_query(query_string)
-        entry_query = get_query(query_string, ['title', 'author', 'course__title', 'course__department__name'])
+        #item search - this will be expanded
+        item_query = get_query(query_string, ['title', 'author'])
+        #need to think about sort order here
+        paginator = Paginator( models.Item.objects.filter(item_query).order_by('-date_created'), 
+            count)
+        #course search
+        course_query = get_query(query_string, ['title', 'department__name'])
+        course_list = models.Course.objects.filter(course_query).order_by('-title')[0:5]
+        #instructor search
         instr_query = get_query(query_string, ['user__last_name'])
-        paginator = Paginator( models.Item.objects.filter(entry_query).order_by('-date_created'), 
-            count)
         instructor_list = models.Member.objects.filter(instr_query).filter(role='INSTR').order_by('-user__last_name')[0:5]
         print(norm_query)
         for term in norm_query:



More information about the open-ils-commits mailing list