Source

cmsplugin-news / cmsplugin_news / search_indexes.py

Konrad Rymczak 58db996 











import datetime
from haystack.indexes import *
from haystack import site
from models import News

class NewsIndex(SearchIndex):
    text = CharField(document=True, use_template=True)
    pub_date = DateTimeField(model_attr='created')

    def index_queryset(self):
        return News.published.all()

site.register(News, NewsIndex)