gestiojeux/inventory/search_indexes.py
Guillaume Bertholon 1850746975 Add inventory search with haystack
Also give a coherent look to all inventory lists
2020-11-28 00:41:11 +01:00

27 lines
661 B
Python

from haystack import indexes
from .models import Category, Tag, Game
class CategoryIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, model_attr="name")
def get_model(self):
return Category
class TagIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, model_attr="name")
def get_model(self):
return Tag
class GameIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(
document=True,
use_template=True,
template_name="inventory/search_indexes/game.txt",
)
def get_model(self):
return Game