1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 06:22:22 +00:00

Index tournaments

This commit is contained in:
Yohann D'ANELLO 2021-01-18 23:49:27 +01:00
parent 96adb01edb
commit cb5f597547
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
8 changed files with 37 additions and 9 deletions

View File

@ -3,7 +3,7 @@
from haystack import indexes
from .models import Participation, Team
from .models import Participation, Team, Tournament
class TeamIndex(indexes.ModelSearchIndex, indexes.Indexable):
@ -24,3 +24,13 @@ class ParticipationIndex(indexes.ModelSearchIndex, indexes.Indexable):
class Meta:
model = Participation
class TournamentIndex(indexes.ModelSearchIndex, indexes.Indexable):
"""
Index all tournaments by their name.
"""
text = indexes.NgramField(document=True, use_template=True)
class Meta:
model = Tournament

View File

@ -1,4 +1,3 @@
{{ object.team.name }}
{{ object.team.trigram }}
{{ object.problem }}
{{ object.get_problem_display }}
{{ object.tournament.name }}

View File

@ -0,0 +1,3 @@
{{ object.name }}
{{ object.place }}
{{ object.description }}

View File

@ -98,12 +98,12 @@
{% with user_object.registration.responsible_email as email %}
<dd class="col-sm-6"><a href="mailto:{{ email }}">{{ email }}</a></dd>
{% endwith %}
{% elif user_object.registration.coachregistration %}
<dt class="col-sm-6 text-right">{% trans "Profesional activity:" %}</dt>
<dd class="col-sm-6">{{ user_object.registration.professional_activity }}</dd>
{% elif user_object.registration.adminregistration %}
{% elif user_object.registration.is_admin %}
<dt class="col-sm-6 text-right">{% trans "Role:" %}</dt>
<dd class="col-sm-6">{{ user_object.registration.role }}</dd>
{% elif user_object.registration.coachregistration or user_object.registration.is_volunteer %}
<dt class="col-sm-6 text-right">{% trans "Profesional activity:" %}</dt>
<dd class="col-sm-6">{{ user_object.registration.professional_activity }}</dd>
{% endif %}
<dt class="col-sm-6 text-right">{% trans "Grant Animath to contact me in the future about other actions:" %}</dt>

View File

@ -3,5 +3,8 @@
{{ object.user.email }}
{{ object.type }}
{{ object.professional_activity }}
{{ object.birth_date }}
{{ object.address }}
{{ object.phone_number }}
{{ object.team.name }}
{{ object.team.trigram }}

View File

@ -4,5 +4,11 @@
{{ object.type }}
{{ object.get_student_class_display }}
{{ object.school }}
{{ object.birth_date }}
{{ object.address }}
{{ object.phone_number }}
{{ object.responsible_name }}
{{ object.reponsible_phone }}
{{ object.reponsible_email }}
{{ object.team.name }}
{{ object.team.trigram }}

View File

@ -0,0 +1,5 @@
{{ object.user.last_name }}
{{ object.user.first_name }}
{{ object.user.email }}
{{ object.type }}
{{ object.professional_activity }}

View File

@ -3,8 +3,8 @@
from django import template
from django_tables2 import Table
from participation.models import Participation, Team
from participation.tables import ParticipationTable, TeamTable
from participation.models import Participation, Team, Tournament
from participation.tables import ParticipationTable, TeamTable, TournamentTable
from ..models import Registration
from ..tables import RegistrationTable
@ -19,6 +19,8 @@ def search_table(results):
table_class = TeamTable
elif issubclass(model_class, Participation):
table_class = ParticipationTable
elif issubclass(model_class, Tournament):
table_class = TournamentTable
return table_class([result.object for result in results], prefix=model_class._meta.model_name)