From 7c145da932191effab00f585664980d2e591b3df Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Wed, 15 Apr 2015 15:07:19 +0200 Subject: redoing full text search using SQL LIKE condition using main home design for displaying results --- pyaggr3g470r/controllers/abstract.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pyaggr3g470r/controllers') diff --git a/pyaggr3g470r/controllers/abstract.py b/pyaggr3g470r/controllers/abstract.py index 8f0a8e3f..29905c0c 100644 --- a/pyaggr3g470r/controllers/abstract.py +++ b/pyaggr3g470r/controllers/abstract.py @@ -25,7 +25,7 @@ class AbstractController(object): each parameters of the function is treated as an equality unless the name of the parameter ends with either "__gt", "__lt", "__ge", "__le", - "__ne" or "__in". + "__ne", "__in" ir "__like". """ if self.user_id is not None: filters[self._user_id_key] = self.user_id @@ -43,6 +43,8 @@ class AbstractController(object): db_filters.add(getattr(self._db_cls, key[:-4]) != value) elif key.endswith('__in'): db_filters.add(getattr(self._db_cls, key[:-4]).in_(value)) + elif key.endswith('__like'): + db_filters.add(getattr(self._db_cls, key[:-6]).like(value)) else: db_filters.add(getattr(self._db_cls, key) == value) return db_filters -- cgit