summaryrefslogtreecommitdiff
path: root/helsinki/program/search_indexes.py
diff options
context:
space:
mode:
authorErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2011-04-07 18:13:09 (GMT)
committerErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2011-04-07 18:13:09 (GMT)
commit975b1111db79bcf63cf47bf72b1b44636dde4f18 (patch)
tree9dfe274585bc6ff825f18799764881d2712f1912 /helsinki/program/search_indexes.py
parent758180007e1a1735b7e7fc871593400fb80054dd (diff)
parent3c5bfc8fe50437e9a8f8b1a259639dc95c56f3d9 (diff)
Merge branch 'develop'
Diffstat (limited to 'helsinki/program/search_indexes.py')
-rw-r--r--helsinki/program/search_indexes.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/helsinki/program/search_indexes.py b/helsinki/program/search_indexes.py
new file mode 100644
index 0000000..8c21e14
--- /dev/null
+++ b/helsinki/program/search_indexes.py
@@ -0,0 +1,23 @@
+from haystack.indexes import CharField, DateTimeField, SearchIndex
+from haystack import site
+
+from datetime import datetime
+
+from program.models import Note, Show
+
+class NoteIndex(SearchIndex):
+ text = CharField(document=True, use_template=True)
+ last_updated = DateTimeField(model_attr='last_updated')
+
+ def get_queryset(self):
+ return Note.objects.filter(last_updated__lte=datetime.now())
+
+class ShowIndex(SearchIndex):
+ text = CharField(document=True, use_template=True)
+ last_updated = DateTimeField(model_attr='last_updated')
+
+ def get_queryset(self):
+ return Show.objects.filter(last_updated__lte=datetime.now())
+
+site.register(Note, NoteIndex)
+site.register(Show, ShowIndex) \ No newline at end of file