Commit f5d8f75b authored by Daniel W Bond's avatar Daniel W Bond
Browse files

added initial search_indexes.py

parent 88339853
from haystack import indexes
from django.utils import timezone # required for when the indexes were last updated
from trajectories.models import Course
class CourseIndex(indexes.SearchIndex, indexes.Indexable):
# search result
# there can only be one document=True per model
text = indexes.CharField( document=True, use_template=True )
# search filtering
name = indexes.CharField( model_attr = 'name' )
contents = indexes.CharField( model_attr = 'courseDescription' )
department = indexes.CharField( model_attr = 'department' )
departmentAbbr = indexes.CharField( model_attr = 'departmentAbbr' )
courseNumber = indexes.CharField( model_attr = 'courseNumber' )
def get_model(self):
return Course
def index_queryset(self, using=None):
return self.get_model().objects.all()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment