it/itf/festival/search_indexes.py

34 lines
957 B
Python
Raw Normal View History

2011-10-10 10:31:09 +00:00
from haystack.indexes import *
from haystack import site
from models import *
class MeetingIndex(SearchIndex):
text = CharField(document=True, use_template=True)
2011-10-11 10:40:02 +00:00
title = CharField(model_attr='title')
intro = CharField(model_attr='intro')
2011-10-10 10:31:09 +00:00
'''
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)
2011-10-11 10:40:02 +00:00
title = CharField(model_attr='title')
intro = CharField(model_attr='intro')
2011-10-10 10:31:09 +00:00
class ParticipantIndex(SearchIndex):
text = CharField(document=True, use_template=True)
2011-10-11 10:40:02 +00:00
name = CharField(model_attr='name')
title = CharField(model_attr='title')
short_bio = CharField(model_attr='short_bio')
2011-10-10 10:31:09 +00:00
site.register(Meeting, MeetingIndex)
site.register(Project, ProjectIndex)
site.register(Participant, ParticipantIndex)