mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-11-09 03:09:57 +01:00
Add distinction between scientific coach and accompanying coach
This commit is contained in:
@@ -61,7 +61,7 @@ class RegistrationAdmin(PolymorphicParentModelAdmin):
|
||||
|
||||
@admin.register(ParticipantRegistration)
|
||||
class ParticipantRegistrationAdmin(PolymorphicChildModelAdmin):
|
||||
list_display = ('user', 'first_name', 'last_name', 'type', 'team', 'email_confirmed',)
|
||||
list_display = ('user', 'first_name', 'last_name', 'type', 'team', 'email_confirmed')
|
||||
list_filter = ('email_confirmed',)
|
||||
search_fields = ('user__first_name', 'user__last_name', 'user__email',)
|
||||
autocomplete_fields = ('user', 'team',)
|
||||
@@ -93,7 +93,7 @@ class StudentRegistrationAdmin(PolymorphicChildModelAdmin):
|
||||
|
||||
@admin.register(CoachRegistration)
|
||||
class CoachRegistrationAdmin(PolymorphicChildModelAdmin):
|
||||
list_display = ('user', 'first_name', 'last_name', 'team', 'email_confirmed',)
|
||||
list_display = ('user', 'first_name', 'last_name', 'team', 'email_confirmed', 'is_accompanying_coach', 'is_scientific_coach')
|
||||
list_filter = ('email_confirmed',)
|
||||
search_fields = ('user__first_name', 'user__last_name', 'user__email',)
|
||||
autocomplete_fields = ('user', 'team',)
|
||||
|
||||
@@ -251,6 +251,9 @@ class CoachRegistrationForm(forms.ModelForm):
|
||||
"""
|
||||
A coach can tell its professional activity.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
if not settings.SUGGEST_ANIMATH:
|
||||
@@ -258,9 +261,9 @@ class CoachRegistrationForm(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = CoachRegistration
|
||||
fields = ('team', 'gender', 'address', 'zip_code', 'city', 'country', 'phone_number',
|
||||
fields = ('team', 'is_scientific_coach', 'is_accompanying_coach', 'gender', 'address', 'zip_code', 'city', 'country', 'phone_number',
|
||||
'last_degree', 'professional_activity', 'health_issues', 'housing_constraints',
|
||||
'give_contact_to_animath', 'email_confirmed',)
|
||||
'give_contact_to_animath', 'email_confirmed')
|
||||
|
||||
|
||||
class VolunteerRegistrationForm(forms.ModelForm):
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.2.8 on 2025-11-06 18:53
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('registration', '0015_alter_participantregistration_gender'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='coachregistration',
|
||||
name='is_accompanying_coach',
|
||||
field=models.BooleanField(default=False, help_text='Accompanies the team during the weekend and stays for the entire tournament.', verbose_name='Accompanying coach'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='coachregistration',
|
||||
name='is_scientific_coach',
|
||||
field=models.BooleanField(default=False, help_text='Provides scientific guidance: methodology, content review, and project mentoring during the preparation phase. <a href="https://tfjm.org/wp-content/uploads/2024/01/note____l_intention_des_encadrants.pdf" target="_blank" rel="noopener">see practical sheet</a>.', verbose_name='Scientific coach'),
|
||||
),
|
||||
]
|
||||
@@ -22,6 +22,7 @@ from phonenumber_field.modelfields import PhoneNumberField
|
||||
from polymorphic.models import PolymorphicModel
|
||||
from tfjm import helloasso
|
||||
from tfjm.tokens import email_validation_token
|
||||
from django.utils.html import format_html
|
||||
|
||||
|
||||
class Registration(PolymorphicModel):
|
||||
@@ -527,6 +528,23 @@ class CoachRegistration(ParticipantRegistration):
|
||||
verbose_name=_("professional activity"),
|
||||
)
|
||||
|
||||
is_scientific_coach = models.BooleanField(
|
||||
default=False,
|
||||
verbose_name=_("Scientific coach"),
|
||||
help_text=format_html(
|
||||
'{} <a href="{}" target="_blank" rel="noopener">{}</a>.',
|
||||
_("Provides scientific guidance: methodology, content review, and project mentoring during the preparation phase."),
|
||||
"https://tfjm.org/wp-content/uploads/2024/01/note____l_intention_des_encadrants.pdf",
|
||||
_("see practical sheet"),
|
||||
),
|
||||
)
|
||||
|
||||
is_accompanying_coach = models.BooleanField(
|
||||
default=False,
|
||||
verbose_name=_("Accompanying coach"),
|
||||
help_text=_("Accompanies the team during the weekend and stays for the entire tournament."),
|
||||
)
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
return _("coach")
|
||||
|
||||
@@ -151,6 +151,12 @@
|
||||
<dd class="col-sm-6"><a href="mailto:{{ email }}">{{ email }}</a></dd>
|
||||
{% endwith %}
|
||||
{% elif user_object.registration.coachregistration %}
|
||||
<dt class="col-sm-6 text-sm-end">{% trans "Scientific coach:" %}</dt>
|
||||
<dd class="col-sm-6">{{ user_object.registration.is_scientific_coach|yesno }}</dd>
|
||||
|
||||
<dt class="col-sm-6 text-sm-end">{% trans "Accompanying coach:" %}</dt>
|
||||
<dd class="col-sm-6">{{ user_object.registration.is_accompanying_coach|yesno }}</dd>
|
||||
|
||||
<dt class="col-sm-6 text-sm-end">{% trans "Most recent degree:" %}</dt>
|
||||
<dd class="col-sm-6">{{ user_object.registration.last_degree }}</dd>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user