Commits

jpotterm committed 59675f6

Upgrade to haystack 2.0

  • Participants
  • Parent commits 58bc51f

Comments (0)

Files changed (2)

File stoat/search_indexes.py

-import datetime
 from haystack.indexes import *
-from haystack import site
-
 from django.conf import settings
-
 from models import Page
 
 INDEX_CLASS = getattr(settings, 'STOAT_HAYSTACK_INDEX_CLASS', None)
 else:
     index = SearchIndex
 
-class PageIndex(index):
+class PageIndex(index, Indexable):
     text = CharField(document=True, use_template=True)
     title = CharField(model_attr='title')
 
+    def get_model(self):
+        return Page
+
     def index_queryset(self):
         """Used when the entire index for model is updated."""
-        return Page.objects.all()
-
-
-site.register(Page, PageIndex)
-
+        return self.get_model().objects.all()

File stoat/templates/search/indexes/stoat/page_text.txt

-{{ object.title }}
-
 {% for pc in object.pagecontent_set.all %}
     {{ pc.content }}
 {% endfor %}