1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-17 09:35:52 +02:00

Use Django-Haystack to make indexed researches

This commit is contained in:
Yohann D'ANELLO
2020-10-15 12:57:20 +02:00
parent b397d00011
commit 6c59bf11be
7 changed files with 90 additions and 1 deletions

View File

@ -0,0 +1,18 @@
from haystack import indexes
from .models import Participation, Team, Video
class TeamIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, model_attr="name")
trigram = indexes.CharField(model_attr="trigram")
def get_model(self):
return Team
class ParticipationIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, model_attr="team__trigram")
def get_model(self):
return Participation