mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 19:02:33 +00:00
Index tournaments
This commit is contained in:
parent
96adb01edb
commit
cb5f597547
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from haystack import indexes
|
from haystack import indexes
|
||||||
|
|
||||||
from .models import Participation, Team
|
from .models import Participation, Team, Tournament
|
||||||
|
|
||||||
|
|
||||||
class TeamIndex(indexes.ModelSearchIndex, indexes.Indexable):
|
class TeamIndex(indexes.ModelSearchIndex, indexes.Indexable):
|
||||||
@ -24,3 +24,13 @@ class ParticipationIndex(indexes.ModelSearchIndex, indexes.Indexable):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Participation
|
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
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
{{ object.team.name }}
|
{{ object.team.name }}
|
||||||
{{ object.team.trigram }}
|
{{ object.team.trigram }}
|
||||||
{{ object.problem }}
|
{{ object.tournament.name }}
|
||||||
{{ object.get_problem_display }}
|
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
{{ object.name }}
|
||||||
|
{{ object.place }}
|
||||||
|
{{ object.description }}
|
@ -98,12 +98,12 @@
|
|||||||
{% with user_object.registration.responsible_email as email %}
|
{% with user_object.registration.responsible_email as email %}
|
||||||
<dd class="col-sm-6"><a href="mailto:{{ email }}">{{ email }}</a></dd>
|
<dd class="col-sm-6"><a href="mailto:{{ email }}">{{ email }}</a></dd>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% elif user_object.registration.coachregistration %}
|
{% elif user_object.registration.is_admin %}
|
||||||
<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 %}
|
|
||||||
<dt class="col-sm-6 text-right">{% trans "Role:" %}</dt>
|
<dt class="col-sm-6 text-right">{% trans "Role:" %}</dt>
|
||||||
<dd class="col-sm-6">{{ user_object.registration.role }}</dd>
|
<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 %}
|
{% endif %}
|
||||||
|
|
||||||
<dt class="col-sm-6 text-right">{% trans "Grant Animath to contact me in the future about other actions:" %}</dt>
|
<dt class="col-sm-6 text-right">{% trans "Grant Animath to contact me in the future about other actions:" %}</dt>
|
||||||
|
@ -3,5 +3,8 @@
|
|||||||
{{ object.user.email }}
|
{{ object.user.email }}
|
||||||
{{ object.type }}
|
{{ object.type }}
|
||||||
{{ object.professional_activity }}
|
{{ object.professional_activity }}
|
||||||
|
{{ object.birth_date }}
|
||||||
|
{{ object.address }}
|
||||||
|
{{ object.phone_number }}
|
||||||
{{ object.team.name }}
|
{{ object.team.name }}
|
||||||
{{ object.team.trigram }}
|
{{ object.team.trigram }}
|
||||||
|
@ -4,5 +4,11 @@
|
|||||||
{{ object.type }}
|
{{ object.type }}
|
||||||
{{ object.get_student_class_display }}
|
{{ object.get_student_class_display }}
|
||||||
{{ object.school }}
|
{{ object.school }}
|
||||||
|
{{ object.birth_date }}
|
||||||
|
{{ object.address }}
|
||||||
|
{{ object.phone_number }}
|
||||||
|
{{ object.responsible_name }}
|
||||||
|
{{ object.reponsible_phone }}
|
||||||
|
{{ object.reponsible_email }}
|
||||||
{{ object.team.name }}
|
{{ object.team.name }}
|
||||||
{{ object.team.trigram }}
|
{{ object.team.trigram }}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
{{ object.user.last_name }}
|
||||||
|
{{ object.user.first_name }}
|
||||||
|
{{ object.user.email }}
|
||||||
|
{{ object.type }}
|
||||||
|
{{ object.professional_activity }}
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from django_tables2 import Table
|
from django_tables2 import Table
|
||||||
from participation.models import Participation, Team
|
from participation.models import Participation, Team, Tournament
|
||||||
from participation.tables import ParticipationTable, TeamTable
|
from participation.tables import ParticipationTable, TeamTable, TournamentTable
|
||||||
|
|
||||||
from ..models import Registration
|
from ..models import Registration
|
||||||
from ..tables import RegistrationTable
|
from ..tables import RegistrationTable
|
||||||
@ -19,6 +19,8 @@ def search_table(results):
|
|||||||
table_class = TeamTable
|
table_class = TeamTable
|
||||||
elif issubclass(model_class, Participation):
|
elif issubclass(model_class, Participation):
|
||||||
table_class = ParticipationTable
|
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)
|
return table_class([result.object for result in results], prefix=model_class._meta.model_name)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user