Update SeasonInformations model and fix bug on SI create_or_update view

This commit is contained in:
Gregory Trullemans 2024-02-04 12:15:01 +01:00
parent 88fa233b7a
commit 5dce3830d0
3 changed files with 37 additions and 4 deletions

View File

@ -0,0 +1,31 @@
# Generated by Django 4.2 on 2024-02-04 11:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("followup", "0062_intensity_difficulty_asked_and_more"),
]
operations = [
migrations.AlterField(
model_name="seasoninformation",
name="number_of_hours_per_week",
field=models.DecimalField(
decimal_places=1, max_digits=3, verbose_name="# Hours/w"
),
),
migrations.AlterField(
model_name="seasoninformation",
name="number_of_s_and_c_hours_per_week",
field=models.DecimalField(
blank=True,
decimal_places=1,
max_digits=3,
null=True,
verbose_name="# S&C hours/w",
),
),
]

View File

@ -758,18 +758,20 @@ class SeasonInformation(models.Model):
number_of_training_sessions_per_week = models.PositiveSmallIntegerField( number_of_training_sessions_per_week = models.PositiveSmallIntegerField(
verbose_name="# Training/w" verbose_name="# Training/w"
) )
number_of_hours_per_week = models.PositiveSmallIntegerField( number_of_hours_per_week = models.DecimalField(
verbose_name="# Hours/w" verbose_name="# Hours/w", max_digits=3, decimal_places=1
) )
number_of_s_and_c_sessions_per_week = models.PositiveSmallIntegerField( number_of_s_and_c_sessions_per_week = models.PositiveSmallIntegerField(
verbose_name="# S&C training/w", verbose_name="# S&C training/w",
blank=True, blank=True,
null=True, null=True,
) )
number_of_s_and_c_hours_per_week = models.PositiveSmallIntegerField( number_of_s_and_c_hours_per_week = models.DecimalField(
verbose_name="# S&C hours/w", verbose_name="# S&C hours/w",
blank=True, blank=True,
null=True, null=True,
max_digits=3,
decimal_places=1,
) )
category = models.PositiveSmallIntegerField( category = models.PositiveSmallIntegerField(
choices=CATEGORY_CHOICES_ARRAY, choices=CATEGORY_CHOICES_ARRAY,

View File

@ -1577,7 +1577,7 @@ def season_information_create_or_update(
title = f"{season_information.gymnast} : Nouvelle information de saison" title = f"{season_information.gymnast} : Nouvelle information de saison"
body = f"""<p>Bonjour,</p> body = f"""<p>Bonjour,</p>
<p>Une nouvelle information de saison enregistrée pour {gymnast}.</p>""" <p>Une nouvelle information de saison enregistrée pour {season_information.gymnast}.</p>"""
Email.objects.create(receivers=receivers, title=title, body=body) Email.objects.create(receivers=receivers, title=title, body=body)