mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-07-03 08:02:48 +02:00
All indexed fields are autocompleted
This commit is contained in:
@ -1,12 +1,11 @@
|
||||
import re
|
||||
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
from corres2math.lists import get_sympa_client
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.validators import RegexValidator
|
||||
from django.db import models
|
||||
from django.db.models import Index
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.crypto import get_random_string
|
||||
from django.utils.text import format_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
@ -121,7 +120,7 @@ class Participation(models.Model):
|
||||
)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse_lazy("participation:team_detail", args=(self.pk,))
|
||||
return reverse_lazy("participation:participation_detail", args=(self.pk,))
|
||||
|
||||
def __str__(self):
|
||||
return _("Participation of the team {name} ({trigram})").format(name=self.team.name, trigram=self.team.trigram)
|
||||
|
@ -4,15 +4,15 @@ 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")
|
||||
text = indexes.EdgeNgramField(document=True, model_attr="name")
|
||||
trigram = indexes.EdgeNgramField(model_attr="trigram")
|
||||
|
||||
def get_model(self):
|
||||
return Team
|
||||
|
||||
|
||||
class ParticipationIndex(indexes.SearchIndex, indexes.Indexable):
|
||||
text = indexes.CharField(document=True, model_attr="team__trigram")
|
||||
text = indexes.EdgeNgramField(document=True, model_attr="team__name")
|
||||
|
||||
def get_model(self):
|
||||
return Participation
|
||||
|
Reference in New Issue
Block a user