gestiojeux/inventory/search_indexes.py
sinavir c01ed7cb47 style(pre-commit): Add hook
Python:
- black
- isort (black profile)
- ruff

Nix:
- statix
- nixfmt-rfc-style
- deadnix
2024-07-04 20:47:46 +02:00

29 lines
662 B
Python

from haystack import indexes
from .models import Category, Game, Tag
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