import datetime
from haystack import indexes, site
from models import ContentPage


#class ImagesPageIndex(indexes.SearchIndex):
#    text = indexes.CharField(document=True, use_template=True)
#    pub_date = indexes.DateTimeField(model_attr='created')
#    
#    def get_model(self):
#        return ImagesPage
#    
#    def index_queryset(self):
#        """Used when the entire index for model is updated."""
#        return self.get_model().objects.all()
#        
#        
#class ItemsPageIndex(indexes.SearchIndex):
#    text = indexes.CharField(document=True, use_template=True)
#    pub_date = indexes.DateTimeField(model_attr='created')
#    
#    def get_model(self):
#        return ItemsPage
#    
#    def index_queryset(self):
#        """Used when the entire index for model is updated."""
#        return self.get_model().objects.all()
#    
#class CoursePageIndex(indexes.SearchIndex):
#    text = indexes.CharField(document=True, use_template=True)
#    pub_date = indexes.DateTimeField(model_attr='created')
#    
#    def get_model(self):
#        return CoursePage
#    
#    def index_queryset(self):
#        """Used when the entire index for model is updated."""
#        return self.get_model().objects.all()

#    


class ContentPageIndex(indexes.SearchIndex):
    text = indexes.CharField(document=True, use_template=True)
    pub_date = indexes.DateTimeField(model_attr='created')
    
    def get_model(self):
        return ContentPage
    
    def index_queryset(self):
        """Used when the entire index for model is updated."""
        return self.get_model().objects.all()


site.register(ContentPage, ContentPageIndex)
#site.register(CoursePage, CoursePageIndex)
