Created
June 5, 2012 19:34
-
-
Save abhinavsingh/2877237 to your computer and use it in GitHub Desktop.
haystack events module search index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
from haystack import indexes | |
from events.models import * | |
class EventIndex(indexes.SearchIndex, indexes.Indexable): | |
text = indexes.CharField(document=True, use_template=True) | |
location = indexes.LocationField(model_attr='get_location') | |
def get_model(self): | |
return Event | |
def index_queryset(self): | |
"""Used when the entire index for model is updated.""" | |
return self.get_model().objects.filter(created_on__lte=datetime.datetime.now()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment