##// END OF EJS Templates
Small thread code refactoring
Small thread code refactoring

File last commit:

r914:000a8767 default
r1026:9aef5e21 default
Show More
search_indexes.py
24 lines | 601 B | text/x-python | PythonLexer
neko259
Implemented search over posts. Moved get_user and get_theme to utils module. Use context processors instead of creating context in the base view. Removed unused imports in some modules
r690 from haystack import indexes
neko259
Added tag search. Refactored search to show any model results in a list.
r692 from boards.models import Post, Tag
neko259
Implemented search over posts. Moved get_user and get_theme to utils module. Use context processors instead of creating context in the base view. Removed unused imports in some modules
r690
__author__ = 'neko259'
class PostIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
def get_model(self):
return Post
def index_queryset(self, using=None):
neko259
Added tag search. Refactored search to show any model results in a list.
r692 return self.get_model().objects.all()
class TagIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
def get_model(self):
return Tag
def index_queryset(self, using=None):
neko259
Fixed search indexes for tags
r914 return self.get_model().objects.all()