itf/itf/bestpractices/search_indexes.py
2011-10-08 03:03:05 -04:00

25 lines
829 B
Python
Executable File

from haystack.indexes import *
from haystack import site
from models import *
class BestPracticeIndex(SearchIndex):
text = CharField(document=True, use_template=True)
title = CharField(model_attr='title')
story = CharField(model_attr='story')
guideline = CharField(model_attr='guideline')
law = CharField(model_attr='law')
theatre = CharField(model_attr='theatre')
quick_howto = CharField(model_attr='quick_howto')
# pub_date = DateTimeField(model_attr='pub_date')
category = CharField(model_attr='category')
# added = DateTimeField(model_attr='added')
'''
def index_queryset(self):
"""Used when the entire index for model is updated."""
return Note.objects.filter(pub_date__lte=datetime.datetime.now())
'''
site.register(BestPractice, BestPracticeIndex)