mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-02-06 10:52:59 +00:00
Index models
This commit is contained in:
parent
f1e5b63b75
commit
19e25b5d1c
@ -3,16 +3,17 @@ from haystack import indexes
|
|||||||
from .models import Participation, Team, Video
|
from .models import Participation, Team, Video
|
||||||
|
|
||||||
|
|
||||||
class TeamIndex(indexes.SearchIndex, indexes.Indexable):
|
class TeamIndex(indexes.ModelSearchIndex, indexes.Indexable):
|
||||||
text = indexes.EdgeNgramField(document=True, model_attr="name")
|
class Meta:
|
||||||
trigram = indexes.EdgeNgramField(model_attr="trigram")
|
model = Team
|
||||||
|
|
||||||
def get_model(self):
|
|
||||||
return Team
|
|
||||||
|
|
||||||
|
|
||||||
class ParticipationIndex(indexes.SearchIndex, indexes.Indexable):
|
class ParticipationIndex(indexes.ModelSearchIndex, indexes.Indexable):
|
||||||
text = indexes.EdgeNgramField(document=True, model_attr="team__name")
|
class Meta:
|
||||||
|
model = Participation
|
||||||
|
|
||||||
|
|
||||||
|
class VideoIndex(indexes.ModelSearchIndex, indexes.Indexable):
|
||||||
|
class Meta:
|
||||||
|
model = Video
|
||||||
|
|
||||||
def get_model(self):
|
|
||||||
return Participation
|
|
||||||
|
@ -3,11 +3,6 @@ from haystack import indexes
|
|||||||
from .models import Registration
|
from .models import Registration
|
||||||
|
|
||||||
|
|
||||||
class RegistrationIndex(indexes.SearchIndex, indexes.Indexable):
|
class RegistrationIndex(indexes.ModelSearchIndex, indexes.Indexable):
|
||||||
text = indexes.EdgeNgramField(document=True, model_attr="user__username")
|
class Meta:
|
||||||
last_name = indexes.EdgeNgramField(model_attr="user__last_name")
|
model = Registration
|
||||||
first_name = indexes.EdgeNgramField(model_attr="user__first_name")
|
|
||||||
email = indexes.EdgeNgramField(model_attr="user__email")
|
|
||||||
|
|
||||||
def get_model(self):
|
|
||||||
return Registration
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user