1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 02:06:52 +00:00

Index models

This commit is contained in:
Yohann D'ANELLO 2020-10-15 16:29:50 +02:00
parent f1e5b63b75
commit 19e25b5d1c
2 changed files with 14 additions and 18 deletions

View File

@ -3,16 +3,17 @@ from haystack import indexes
from .models import Participation, Team, Video
class TeamIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, model_attr="name")
trigram = indexes.EdgeNgramField(model_attr="trigram")
def get_model(self):
return Team
class TeamIndex(indexes.ModelSearchIndex, indexes.Indexable):
class Meta:
model = Team
class ParticipationIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, model_attr="team__name")
class ParticipationIndex(indexes.ModelSearchIndex, indexes.Indexable):
class Meta:
model = Participation
class VideoIndex(indexes.ModelSearchIndex, indexes.Indexable):
class Meta:
model = Video
def get_model(self):
return Participation

View File

@ -3,11 +3,6 @@ from haystack import indexes
from .models import Registration
class RegistrationIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, model_attr="user__username")
last_name = indexes.EdgeNgramField(model_attr="user__last_name")
first_name = indexes.EdgeNgramField(model_attr="user__first_name")
email = indexes.EdgeNgramField(model_attr="user__email")
def get_model(self):
return Registration
class RegistrationIndex(indexes.ModelSearchIndex, indexes.Indexable):
class Meta:
model = Registration