[open-ils-commits] r1371 - servres/trunk/conifer/syrup/views (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Apr 16 14:05:32 EDT 2011
Author: gfawcett
Date: 2011-04-16 14:05:28 -0400 (Sat, 16 Apr 2011)
New Revision: 1371
Modified:
servres/trunk/conifer/syrup/views/search.py
Log:
search by course-code, and by exact barcode.
Modified: servres/trunk/conifer/syrup/views/search.py
===================================================================
--- servres/trunk/conifer/syrup/views/search.py 2011-04-15 20:25:52 UTC (rev 1370)
+++ servres/trunk/conifer/syrup/views/search.py 2011-04-16 18:05:28 UTC (rev 1371)
@@ -53,7 +53,11 @@
"""
def clause(field_name, expression):
- return Q(**{"%s__icontains" % field_name: expression})
+ if field_name.startswith('EXACT:'):
+ field_name = field_name[6:]
+ return Q(**{"%s__iexact" % field_name: expression})
+ else:
+ return Q(**{"%s__icontains" % field_name: expression})
terms = normalize_query(query_string)
@@ -83,7 +87,8 @@
# them all up.
term_filter = build_query(query_string, ['title', 'author',
- 'publisher', 'marcxml'])
+ 'publisher', 'marcxml',
+ 'EXACT:barcode'])
if ENABLE_USER_FILTERS and user:
user_filter = models.Item.filter_for_user(user)
else:
@@ -104,7 +109,8 @@
# any sites as results.
sites = models.Site.objects.none()
else:
- term_filter = build_query(query_string, ['course__name',
+ term_filter = build_query(query_string, ['course__code',
+ 'course__name',
'course__department__name',
'owner__last_name',
'owner__first_name'])
More information about the open-ils-commits
mailing list