diff --git a/registration/forms.py b/registration/forms.py index 053b2e2..bbebc06 100644 --- a/registration/forms.py +++ b/registration/forms.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later from django import forms +from django.conf import settings from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from django.core.exceptions import ValidationError @@ -103,6 +104,8 @@ class StudentRegistrationForm(forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["birth_date"].widget = forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d') + if not settings.SUGGEST_ANIMATH: + del self.fields["give_contact_to_animath"] class Meta: model = StudentRegistration @@ -248,6 +251,11 @@ 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: + del self.fields["give_contact_to_animath"] + class Meta: model = CoachRegistration fields = ('team', 'gender', 'address', 'zip_code', 'city', 'country', 'phone_number', @@ -259,6 +267,11 @@ class VolunteerRegistrationForm(forms.ModelForm): """ A volunteer can also tell its professional activity. """ + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + if not settings.SUGGEST_ANIMATH: + del self.fields["give_contact_to_animath"] + class Meta: model = VolunteerRegistration fields = ('professional_activity', 'admin', 'give_contact_to_animath', 'email_confirmed',) diff --git a/registration/templates/registration/user_detail.html b/registration/templates/registration/user_detail.html index 4cc1007..dc1aa7f 100644 --- a/registration/templates/registration/user_detail.html +++ b/registration/templates/registration/user_detail.html @@ -165,8 +165,10 @@
{{ user_object.registration.is_admin|yesno }}
{% endif %} -
{% trans "Grant Animath to contact me in the future about other actions:" %}
-
{{ user_object.registration.give_contact_to_animath|yesno }}
+ {% if TFJM.SUGGEST_ANIMATH %} +
{% trans "Grant Animath to contact me in the future about other actions:" %}
+
{{ user_object.registration.give_contact_to_animath|yesno }}
+ {% endif %} {% if TFJM.PAYMENT_MANAGEMENT and user_object.registration.participates and user_object.registration.team.participation.valid %} diff --git a/tfjm/context_processors.py b/tfjm/context_processors.py index 395f4ee..29a0ae7 100644 --- a/tfjm/context_processors.py +++ b/tfjm/context_processors.py @@ -14,5 +14,6 @@ def tfjm_context(request): 'HEALTH_SHEET_REQUIRED': settings.HEALTH_SHEET_REQUIRED, 'VACCINE_SHEET_REQUIRED': settings.VACCINE_SHEET_REQUIRED, 'MOTIVATION_LETTER_REQUIRED': settings.MOTIVATION_LETTER_REQUIRED, + 'SUGGEST_ANIMATH': settings.SUGGEST_ANIMATH, } } diff --git a/tfjm/settings.py b/tfjm/settings.py index ae487a3..ca50624 100644 --- a/tfjm/settings.py +++ b/tfjm/settings.py @@ -355,6 +355,7 @@ if TFJM_APP == "TFJM": HEALTH_SHEET_REQUIRED = True VACCINE_SHEET_REQUIRED = True MOTIVATION_LETTER_REQUIRED = True + SUGGEST_ANIMATH = True PROBLEMS = [ "Triominos", @@ -376,7 +377,7 @@ elif TFJM_APP == "ETEAM": HEALTH_SHEET_REQUIRED = False VACCINE_SHEET_REQUIRED = False MOTIVATION_LETTER_REQUIRED = False - + SUGGEST_ANIMATH = False PROBLEMS = [ "Exploring Flatland",