Mercurial > public > sg101
comparison gpp/forums/search_indexes.py @ 222:a5fcf3d1b663
For #51; add forums to Haystack search.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 06 Jun 2010 21:05:48 +0000 |
parents | |
children | d424b8bae71d |
comparison
equal
deleted
inserted
replaced
221:8d13baeaa5c1 | 222:a5fcf3d1b663 |
---|---|
1 """Haystack search index for the weblinks application.""" | |
2 from haystack.indexes import * | |
3 from haystack import site | |
4 | |
5 from forums.models import Forum, Post | |
6 | |
7 | |
8 class PostIndex(SearchIndex): | |
9 text = CharField(document=True, use_template=True) | |
10 author = CharField(model_attr='user') | |
11 pub_date = DateTimeField(model_attr='creation_date') | |
12 | |
13 def get_queryset(self): | |
14 return Post.objects.filter( | |
15 topic__forum__in=Forum.objects.public_forums()) | |
16 | |
17 | |
18 site.register(Post, PostIndex) |