Add BMI into heightweith model
This commit is contained in:
parent
e5970da66d
commit
60002cfdeb
|
@ -511,6 +511,10 @@ class HeightWeight(Seasonisable):
|
||||||
)
|
)
|
||||||
weight = models.DecimalField(max_digits=4, decimal_places=1, verbose_name="Weight")
|
weight = models.DecimalField(max_digits=4, decimal_places=1, verbose_name="Weight")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def bmi(self):
|
||||||
|
return self.weight / (self.height * self.height)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.gymnast} : {self.height}/{self.hips_height} - {self.weight}"
|
return f"{self.gymnast} : {self.height}/{self.hips_height} - {self.weight}"
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
<th class="header text-left">Height</th>
|
<th class="header text-left">Height</th>
|
||||||
<th class="header text-left">Hips height</th>
|
<th class="header text-left">Hips height</th>
|
||||||
<th class="header text-left">Weight</th>
|
<th class="header text-left">Weight</th>
|
||||||
|
<th class="header text-left">BMI</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -47,6 +48,7 @@
|
||||||
<td>{{ heightweight.height }}</td>
|
<td>{{ heightweight.height }}</td>
|
||||||
<td>{{ heightweight.hips_height }}</td>
|
<td>{{ heightweight.hips_height }}</td>
|
||||||
<td>{{ heightweight.weight }}</td>
|
<td>{{ heightweight.weight }}</td>
|
||||||
|
<td>{{ heightweight.bmi }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -77,7 +79,7 @@
|
||||||
paging: false,
|
paging: false,
|
||||||
searching: false,
|
searching: false,
|
||||||
ordering: false,
|
ordering: false,
|
||||||
// "bInfo" : false,
|
"bInfo" : false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1100,16 +1100,16 @@ def heightweight_create_or_update(request, heightweight_id=None, gymnast_id=None
|
||||||
|
|
||||||
send_mail(
|
send_mail(
|
||||||
f"{gymnast} : Nouveau poids/taille enregistré",
|
f"{gymnast} : Nouveau poids/taille enregistré",
|
||||||
f"Un nouveau poids/taille enregistré pour {gymnast} ({date}) : {height}cm / {weight}kg (BMI: {bmi}).",
|
f"Un nouveau poids/taille enregistré pour {gymnast} ({date}) : {height} cm / {weight} kg (BMI: {bmi}).",
|
||||||
settings.EMAIL_HOST_USER,
|
settings.EMAIL_HOST_USER,
|
||||||
receiver,
|
receiver,
|
||||||
fail_silently=False,
|
fail_silently=False,
|
||||||
html_message=f"""<p>Bonjour,</p>
|
html_message=f"""<p>Bonjour,</p>
|
||||||
<p>Un nouveau poids/taille enregistré pour {gymnast} pour le {date.strftime('%d %B %Y')} :</p>
|
<p>Un nouveau poids/taille enregistré pour {gymnast} pour le {date.strftime('%d %B %Y')} :</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>{height}cm</li>
|
<li>Height: {height} cm</li>
|
||||||
<li>{weight}kg</li>
|
<li>Weight: {weight} kg</li>
|
||||||
<li>BMI : {bmi}</li>
|
<li>BMI: {bmi}</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br />
|
<br />
|
||||||
<p>Excellente journée</p>
|
<p>Excellente journée</p>
|
||||||
|
|
Loading…
Reference in New Issue