1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 03:58:26 +02:00

The health sheet is required only for children

This commit is contained in:
Yohann D'ANELLO
2021-01-21 21:55:19 +01:00
parent ae520f791c
commit 72fe279f15
8 changed files with 50 additions and 25 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 3.0.11 on 2021-01-21 20:53
from django.db import migrations, models
import registration.models
class Migration(migrations.Migration):
dependencies = [
('registration', '0003_auto_20210118_1738'),
]
operations = [
migrations.RemoveField(
model_name='participantregistration',
name='health_sheet',
),
migrations.AddField(
model_name='studentregistration',
name='health_sheet',
field=models.FileField(blank=True, default='', upload_to=registration.models.get_random_health_filename, verbose_name='health sheet'),
),
]

View File

@ -146,13 +146,6 @@ class ParticipantRegistration(Registration):
default="",
)
health_sheet = models.FileField(
verbose_name=_("health sheet"),
upload_to=get_random_health_filename,
blank=True,
default="",
)
@property
def under_18(self):
return (timezone.now().date() - self.birth_date).days < 18 * 365.24
@ -208,6 +201,13 @@ class StudentRegistration(ParticipantRegistration):
default="",
)
health_sheet = models.FileField(
verbose_name=_("health sheet"),
upload_to=get_random_health_filename,
blank=True,
default="",
)
@property
def type(self):
return _("student")

View File

@ -106,7 +106,7 @@ Signature pr\'ec\'ed\'ee de la mention \og lu et approuv\'e \fg{}
\begin{minipage}[c]{0.5\textwidth}
\underline{L'\'el\`eve :}\\
\underline{Le participant :}\\
Fait \`a :\\
le

View File

@ -57,20 +57,20 @@
<button class="btn btn-primary" data-toggle="modal" data-target="#uploadPhotoAuthorizationModal">{% trans "Replace" %}</button>
{% endif %}
</dd>
<dt class="col-sm-6 text-right">{% trans "Health sheet:" %}</dt>
<dd class="col-sm-6">
{% if user_object.registration.health_sheet %}
<a href="{{ user_object.registration.health_sheet.url }}" data-turbolinks="false">{% trans "Download" %}</a>
{% endif %}
{% if user_object.registration.team and not user_object.registration.team.participation.valid %}
<button class="btn btn-primary" data-toggle="modal" data-target="#uploadHealthSheetModal">{% trans "Replace" %}</button>
{% endif %}
</dd>
{% endif %}
{% if user_object.registration.studentregistration %}
{% if user_object.registration.under_18 %}
<dt class="col-sm-6 text-right">{% trans "Health sheet:" %}</dt>
<dd class="col-sm-6">
{% if user_object.registration.health_sheet %}
<a href="{{ user_object.registration.health_sheet.url }}" data-turbolinks="false">{% trans "Download" %}</a>
{% endif %}
{% if user_object.registration.team and not user_object.registration.team.participation.valid %}
<button class="btn btn-primary" data-toggle="modal" data-target="#uploadHealthSheetModal">{% trans "Replace" %}</button>
{% endif %}
</dd>
<dt class="col-sm-6 text-right">{% trans "Parental authorization:" %}</dt>
<dd class="col-sm-6">
{% if user_object.registration.parental_authorization %}

View File

@ -30,7 +30,7 @@ urlpatterns = [
path("photo-authorization-template/child/", ChildPhotoAuthorizationTemplateView.as_view(),
name="photo_authorization_child_template"),
path("instructions-template/", InstructionsTemplateView.as_view(), name="instructions_template"),
path("user/<int:pk>/upload-health_sheet/", UserUploadHealthSheetView.as_view(),
path("user/<int:pk>/upload-health-sheet/", UserUploadHealthSheetView.as_view(),
name="upload_user_health_sheet"),
path("user/<int:pk>/upload-parental-authorization/", UserUploadParentalAuthorizationView.as_view(),
name="upload_user_parental_authorization"),