diff --git a/apps/participation/search_indexes.py b/apps/participation/search_indexes.py index 1512a71..e67f758 100644 --- a/apps/participation/search_indexes.py +++ b/apps/participation/search_indexes.py @@ -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 diff --git a/apps/participation/templates/search/indexes/participation/participation_text.txt b/apps/participation/templates/search/indexes/participation/participation_text.txt index 57aa6bc..740c12e 100644 --- a/apps/participation/templates/search/indexes/participation/participation_text.txt +++ b/apps/participation/templates/search/indexes/participation/participation_text.txt @@ -1,4 +1,3 @@ {{ object.team.name }} {{ object.team.trigram }} -{{ object.problem }} -{{ object.get_problem_display }} +{{ object.tournament.name }} diff --git a/apps/participation/templates/search/indexes/participation/tournament_text.txt b/apps/participation/templates/search/indexes/participation/tournament_text.txt new file mode 100644 index 0000000..b5fb63a --- /dev/null +++ b/apps/participation/templates/search/indexes/participation/tournament_text.txt @@ -0,0 +1,3 @@ +{{ object.name }} +{{ object.place }} +{{ object.description }} diff --git a/apps/registration/templates/registration/user_detail.html b/apps/registration/templates/registration/user_detail.html index e29baf4..28df841 100644 --- a/apps/registration/templates/registration/user_detail.html +++ b/apps/registration/templates/registration/user_detail.html @@ -98,12 +98,12 @@ {% with user_object.registration.responsible_email as email %}
{{ email }}
{% endwith %} - {% elif user_object.registration.coachregistration %} -
{% trans "Profesional activity:" %}
-
{{ user_object.registration.professional_activity }}
- {% elif user_object.registration.adminregistration %} + {% elif user_object.registration.is_admin %}
{% trans "Role:" %}
{{ user_object.registration.role }}
+ {% elif user_object.registration.coachregistration or user_object.registration.is_volunteer %} +
{% trans "Profesional activity:" %}
+
{{ user_object.registration.professional_activity }}
{% endif %}
{% trans "Grant Animath to contact me in the future about other actions:" %}
diff --git a/apps/registration/templates/search/indexes/registration/coachregistration_text.txt b/apps/registration/templates/search/indexes/registration/coachregistration_text.txt index e7e53e5..e08b187 100644 --- a/apps/registration/templates/search/indexes/registration/coachregistration_text.txt +++ b/apps/registration/templates/search/indexes/registration/coachregistration_text.txt @@ -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 }} diff --git a/apps/registration/templates/search/indexes/registration/studentregistration_text.txt b/apps/registration/templates/search/indexes/registration/studentregistration_text.txt index f103c7f..9eefe38 100644 --- a/apps/registration/templates/search/indexes/registration/studentregistration_text.txt +++ b/apps/registration/templates/search/indexes/registration/studentregistration_text.txt @@ -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 }} diff --git a/apps/registration/templates/search/indexes/registration/volunteerregistration_text.txt b/apps/registration/templates/search/indexes/registration/volunteerregistration_text.txt new file mode 100644 index 0000000..02ad2a3 --- /dev/null +++ b/apps/registration/templates/search/indexes/registration/volunteerregistration_text.txt @@ -0,0 +1,5 @@ +{{ object.user.last_name }} +{{ object.user.first_name }} +{{ object.user.email }} +{{ object.type }} +{{ object.professional_activity }} diff --git a/apps/registration/templatetags/search_results_tables.py b/apps/registration/templatetags/search_results_tables.py index 318e7d0..b9b7a32 100644 --- a/apps/registration/templatetags/search_results_tables.py +++ b/apps/registration/templatetags/search_results_tables.py @@ -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)