itf/itf/festival/search_indexes.py
2011-10-11 16:10:02 +05:30

34 lines
957 B
Python
Executable File

from haystack.indexes import *
from haystack import site
from models import *
class MeetingIndex(SearchIndex):
text = CharField(document=True, use_template=True)
title = CharField(model_attr='title')
intro = CharField(model_attr='intro')
'''
def index_queryset(self):
"""Used when the entire index for model is updated."""
return Note.objects.filter(pub_date__lte=datetime.datetime.now())
'''
class ProjectIndex(SearchIndex):
text = CharField(document=True, use_template=True)
title = CharField(model_attr='title')
intro = CharField(model_attr='intro')
class ParticipantIndex(SearchIndex):
text = CharField(document=True, use_template=True)
name = CharField(model_attr='name')
title = CharField(model_attr='title')
short_bio = CharField(model_attr='short_bio')
site.register(Meeting, MeetingIndex)
site.register(Project, ProjectIndex)
site.register(Participant, ParticipantIndex)