Sith/core/search_indexes.py

16 lines
380 B
Python
Raw Normal View History

2016-12-19 18:58:51 +00:00
from haystack import indexes
from core.models import User
class UserIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
def get_model(self):
return User
def index_queryset(self, using=None):
"""Used when the entire index for model is updated."""
return self.get_model().objects.all()