Add Stability and Quality of movement
This commit is contained in:
parent
175e1e42a1
commit
b3652831e1
|
@ -0,0 +1,91 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load has_group %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-sm-12 col-md-8 col-lg-8 col-xl-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="">{% if quality_of_movement_id %}Edit{% else %}Add{% endif %} Quality of movement</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{% if quality_of_movement_id %}{% url 'quality_of_movement_update' quality_of_movement_id %}{% else %}{% url 'quality_of_movement_create' %}{% endif %}" method="post" class="form-horizontal" id="formulaire" name="formulaire">
|
||||
{% csrf_token %}
|
||||
<div class="form-group row ">
|
||||
<label for="id_date" class="col-4 col-sm-3 col-form-label">Gymnast <span class="text-danger"><b>*</b></span></label>
|
||||
<div class="col-sm-8 col-md-6 col-lg-6 col-xl-6 {% if form.jumper.errors %}has-danger{% endif %}">
|
||||
{% if request.user|has_group:"trainer" %}
|
||||
{{ form.gymnast }}
|
||||
{{ form.gymnast_related }}
|
||||
{% if form.gymnast.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.gymnast.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
{% else %}
|
||||
<input type="text" class="form-control" value="{{ request.user.first_name }} {{ request.user.last_name }}" readonly="readonly" />
|
||||
<input type="hidden" name="gymnast" id="gymnast" value="{{ request.user.gymnast.id }}" />
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_date" class="col-4 col-sm-3 col-form-label">{{ form.date.label }} <span class="text-danger"><b>*</b></span></label>
|
||||
<div class="col-sm-3 col-md-4 col-lg-4 col-xl-4 {% if form.date.errors %}has-danger{% endif %}">
|
||||
{{ form.date }}
|
||||
{% if form.date.errors %}<span class="btn btn-sm btn-danger-outline">{% for error in form.date.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_overhead_squat" class="col-4 col-sm-3 col-form-label">{{ form.overhead_squat.label }}<span class="text-danger"><b>*</b></span></label>
|
||||
<div class="col-5 col-sm-3 col-md-2 col-lg-5 col-xl-5 {% if form.overhead_squat.errors %}has-danger{% endif %}">
|
||||
{{ form.overhead_squat }}
|
||||
{% if form.overhead_squat.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.overhead_squat.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_single_leg_drop_jump" class="col-4 col-sm-3 col-form-label">{{ form.single_leg_drop_jump.label }} <span class="text-danger"><b>*</b></span></label>
|
||||
<div class="col-5 col-sm-3 col-md-2 col-lg-5 col-xl-5 {% if form.single_leg_drop_jump.errors %}has-danger{% endif %}">
|
||||
{{ form.single_leg_drop_jump }}
|
||||
{% if form.single_leg_drop_jump.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.single_leg_drop_jump.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_single_leg_stability_right" class="col-4 col-sm-3 col-form-label">{{ form.single_leg_stability_right.label }}<span class="text-danger"><b>*</b></span></label>
|
||||
<div class="col-5 col-sm-3 col-md-2 col-lg-2 col-xl-2 {% if form.single_leg_stability_right.errors %}has-danger{% endif %}">
|
||||
{{ form.single_leg_stability_right }}
|
||||
{% if form.single_leg_stability_right.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.single_leg_stability_right.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_single_leg_stability_left" class="col-4 col-sm-3 col-form-label">{{ form.single_leg_stability_left.label }}<span class="text-danger"><b>*</b></span></label>
|
||||
<div class="col-5 col-sm-3 col-md-2 col-lg-2 col-xl-2 {% if form.single_leg_stability_left.errors %}has-danger{% endif %}">
|
||||
{{ form.single_leg_stability_left }}
|
||||
{% if form.single_leg_stability_left.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.single_leg_stability_left.errors %}{{ error }}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" value="{% if stability_id %}Save{% else %}Add{% endif %}" class="btn btn-warning" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footerscript %}
|
||||
<script type="text/javascript" >
|
||||
$(function(){
|
||||
blackDashboard.initDateTimePicker();
|
||||
});
|
||||
|
||||
const csrf_token = "{{ csrf_token|escapejs }}";
|
||||
const gymnast_lookup = "{% url 'gymnast_lookup' %}";
|
||||
const skill_lookup = "{% url 'skill_lookup' %}";
|
||||
</script>
|
||||
<script src="{% static "js/template_users/datepicker_maxdate_today.js" %}"></script>
|
||||
{% if request.session.template == 0 %}
|
||||
<script src="{% static "js/template_users/gymnast_autocomplete_black.js" %}"></script>
|
||||
<script src="{% static "js/template_users/skill_autocomplete_black.js" %}"></script>
|
||||
{% else %}
|
||||
<script src="{% static "js/template_users/gymnast_autocomplete.js" %}"></script>
|
||||
<script src="{% static "js/template_users/skill_autocomplete.js" %}"></script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -0,0 +1,56 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-sm-8 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="mb-0">Quality of Movement on {{ quality_of_movement.date | date:"j N Y" }}</h4>
|
||||
<a href="{% url 'gymnast_details_tab' quality_of_movement.gymnast.id 'physiological' %}">{{ quality_of_movement.gymnast }}</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<td>overhead Squat</td>
|
||||
<td>
|
||||
{% for overhead_squat in qof_overhead_squat %}
|
||||
{{ overhead_squat }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Single Leg Drop Jump</td>
|
||||
<td>
|
||||
{% for single_leg_drop_jump in qof_single_leg_drop_jump %}
|
||||
{{ single_leg_drop_jump }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Single leg stability right</td>
|
||||
<td>{{ quality_of_movement.single_leg_stability_right }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Single leg stability left</td>
|
||||
<td>{{ quality_of_movement.single_leg_stability_left }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="card-footer pl-0 pb-0">
|
||||
<a href="{% url 'quality_of_movement_list' %}">
|
||||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||||
<i class="tim-icons icon-double-left"></i>
|
||||
</button>
|
||||
</a>
|
||||
<a href="{% url 'quality_of_movement_create_for_gymnast' quality_of_movement.gymnast.id %}">
|
||||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||||
+
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,86 @@
|
|||
{% extends "listing.html" %}
|
||||
|
||||
{% block datacontent %}
|
||||
<div class="card mb-0">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h4 class=""> Quality of Movement Listing</h4>
|
||||
</div>
|
||||
<div class="col-1 ml-auto">
|
||||
<div class="text-right">
|
||||
<a href="{% url 'quality_of_movement_create' %}">
|
||||
<button type="submit" value="add" class="btn btn-icon btn-warning">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
{% if quality_of_movement_list %}
|
||||
<table class="table tablesorter table-striped" data-sort="table" id="stability_table">
|
||||
<thead class="text-primary">
|
||||
<tr>
|
||||
<th style="width: 3%"></th>
|
||||
<th class="header text-left" style="width: 8%">Date</th>
|
||||
<th class="header text-left" style="width: 20%">Gymnast</th>
|
||||
<th class="header text-left">overhead_squat</th>
|
||||
<th class="header text-left">sl_drop_jump</th>
|
||||
<th class="header text-left">sl_stability_right</th>
|
||||
<th class="header text-left">sl_stability_left</th>
|
||||
<!-- <th class="header text-left">sl_bridge</th>
|
||||
<th class="header text-left">side_plank_leg_raise</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for quality_of_movement in quality_of_movement_list %}
|
||||
<tr role="row" class="{% cycle 'odd' 'even' %}">
|
||||
<td>
|
||||
<a href="{% url 'injury_update' quality_of_movement.id %}">
|
||||
<span class="tim-icons icon-pencil text-warning"></span>
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-left"><a href="{% url 'quality_of_movement_details' quality_of_movement.id %}">{{ quality_of_movement.date | date:"d-m-Y" }}</a></td>
|
||||
<td class="text-left"><a href="{% url 'gymnast_details_tab' quality_of_movement.gymnast.id 'physiological' %}">{{ quality_of_movement.gymnast }}</a></td>
|
||||
<!-- <td class="text-left">{{ quality_of_movement.overhead_squat.all }}</td>
|
||||
<td class="text-left">{{ quality_of_movement.single_leg_drop_jump.all }}</td> -->
|
||||
<td class="text-left">{{ quality_of_movement.single_leg_stability_right }}</td>
|
||||
<td class="text-left">{{ quality_of_movement.single_leg_stability_left }}</td>
|
||||
<!-- <td class="text-right">{{ quality_of_movement.sl_bridge }}</td>
|
||||
<td class="text-right">{{ quality_of_movement.side_plank_leg_raise }}</td> -->
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="muted-text">There are no injury corresponding to your criterias.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footerscript %}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#stability_table').tablesorter({
|
||||
headers: {
|
||||
0: { sorter: false }, // disable first column
|
||||
},
|
||||
dateFormat: "uk",
|
||||
sortList: [[1, 1]]
|
||||
});
|
||||
|
||||
$('#stability_table').DataTable({
|
||||
scrollY: 500,
|
||||
paging: false,
|
||||
searching: false,
|
||||
ordering: false,
|
||||
"bInfo": false,
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -63,6 +63,122 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center ml-1">
|
||||
<div class="col-md-6">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<h4>Stability</h4>
|
||||
</div>
|
||||
<div class="card-body pt-0 pb-0 pr-0 pl-0">
|
||||
{% if stability_list %}
|
||||
<table class="table" id="previous_events">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class='header text-left'>Date</th>
|
||||
<th class='header text-center'>T1</th>
|
||||
<th class='header text-center'>T2</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for stability in stability_list %}
|
||||
<tr>
|
||||
<td class="text-left">
|
||||
<a href="{% url 'stability_update' stability.id %}">
|
||||
<span class="tim-icons icon-pencil text-warning"></span>
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-left">
|
||||
<a href="{% url 'note_details' stability.id %}">
|
||||
{{ stability.date | date:"d-m-Y" }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center">{{ stability.anterior_chain }}</td>
|
||||
<td class="text-center">{{ stability.posterior_chain_left }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="pl-3 text-muted">No stability recorded for this gymnast.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-footer text-right text-muted pt-0">
|
||||
{% if stability_list %}
|
||||
<a href="{% url 'stability_list_for_gymnast' gymnast_id %}">
|
||||
<button type="submit" value="list" class="btn btn-icon btn-warning mr-2">
|
||||
<i class="far fa-list-alt"></i>
|
||||
</button>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<a href="{% url 'stability_create_for_gymnast' gymnast_id %}">
|
||||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<h4>Quality of Movement</h4>
|
||||
</div>
|
||||
<div class="card-body pt-0 pb-0 pr-0 pl-0">
|
||||
{% if quality_of_movement_list %}
|
||||
<table class="table" id="previous_events">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class='header text-left'>Date</th>
|
||||
<th class='header text-center'>T1</th>
|
||||
<th class='header text-center'>T2</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for quality_of_movement in quality_of_movement_list %}
|
||||
<tr>
|
||||
<td class="text-left">
|
||||
<a href="{% url 'quality_of_movement_update' quality_of_movement.id %}">
|
||||
<span class="tim-icons icon-pencil text-warning"></span>
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-left">
|
||||
<a href="{% url 'quality_of_movement_details' quality_of_movement.id %}">
|
||||
{{ quality_of_movement.date | date:"d-m-Y" }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center">{{ quality_of_movement.sl_stability_right }}</td>
|
||||
<td class="text-center">{{ quality_of_movement.sl_stability_left }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="pl-3 text-muted">No Quality of movement recorded for this gymnast.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-footer text-right text-muted pt-0">
|
||||
{% if quality_of_movement_list %}
|
||||
<a href="{% url 'quality_of_movement_list_for_gymnast' gymnast_id %}">
|
||||
<button type="submit" value="list" class="btn btn-icon btn-warning mr-2">
|
||||
<i class="far fa-list-alt"></i>
|
||||
</button>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<a href="{% url 'quality_of_movement_create_for_gymnast' gymnast_id %}">
|
||||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center ml-1">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
|
|
|
@ -24,6 +24,9 @@ from .models import (
|
|||
GymnastHasRoutine,
|
||||
SeasonInformation,
|
||||
NumberOfRoutineDone,
|
||||
OverheadSquat,
|
||||
DropJump,
|
||||
QualityOfMovement,
|
||||
)
|
||||
|
||||
|
||||
|
@ -309,6 +312,41 @@ class StabilityAdmin(admin.ModelAdmin):
|
|||
autocomplete_fields = ("gymnast",)
|
||||
|
||||
|
||||
class OverheadSquatAdmin(admin.ModelAdmin):
|
||||
model = OverheadSquat
|
||||
|
||||
list_display = ("label",)
|
||||
fields = ("label",)
|
||||
search_fields = ("label",)
|
||||
|
||||
|
||||
class DropJumpAdmin(admin.ModelAdmin):
|
||||
model = DropJump
|
||||
|
||||
list_display = ("label",)
|
||||
fields = ("label",)
|
||||
search_fields = ("label",)
|
||||
|
||||
|
||||
class QualityOfMovementAdmin(admin.ModelAdmin):
|
||||
model = QualityOfMovement
|
||||
|
||||
list_display = (
|
||||
"date",
|
||||
"gymnast",
|
||||
# "overhead_squat",
|
||||
# "sl_drop_jump",
|
||||
"single_leg_stability_right",
|
||||
"single_leg_stability_left"
|
||||
)
|
||||
list_filter = (("gymnast", RelatedDropdownFilter),)
|
||||
search_fields = (
|
||||
"gymnast__firstname",
|
||||
"gymnast__lastname",
|
||||
)
|
||||
autocomplete_fields = ("gymnast",)
|
||||
|
||||
|
||||
admin.site.register(Plan, PlanAdmin)
|
||||
admin.site.register(Note, NoteAdmin)
|
||||
admin.site.register(Point, PointAdmin)
|
||||
|
@ -327,3 +365,7 @@ admin.site.register(NumberOfRoutineDone, NumberOfRoutineDoneAdmin)
|
|||
admin.site.register(SLBridge, SLBridgeAdmin)
|
||||
admin.site.register(SidePlankLegRaise, SidePlankLegRaiseAdmin)
|
||||
admin.site.register(Stability, StabilityAdmin)
|
||||
|
||||
admin.site.register(OverheadSquat, OverheadSquatAdmin)
|
||||
admin.site.register(DropJump, DropJumpAdmin)
|
||||
admin.site.register(QualityOfMovement, QualityOfMovementAdmin)
|
||||
|
|
|
@ -13,6 +13,7 @@ from .models import (
|
|||
HeightWeight,
|
||||
LearnedSkill,
|
||||
GymnastHasRoutine,
|
||||
QualityOfMovement,
|
||||
SeasonInformation,
|
||||
NumberOfRoutineDone,
|
||||
)
|
||||
|
@ -312,6 +313,58 @@ class StabilityForm(forms.ModelForm):
|
|||
)
|
||||
|
||||
|
||||
class QualityOfMovementForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = QualityOfMovement
|
||||
fields = (
|
||||
"gymnast",
|
||||
"date",
|
||||
"overhead_squat",
|
||||
"single_leg_drop_jump",
|
||||
"single_leg_stability_right",
|
||||
"single_leg_stability_left",
|
||||
)
|
||||
widgets = {
|
||||
"date": forms.DateInput(
|
||||
attrs={
|
||||
"class": "form-control datepicker",
|
||||
"placeholder": date.today().strftime("%Y-%m-%d"),
|
||||
"value": date.today().strftime("%Y-%m-%d"),
|
||||
}
|
||||
),
|
||||
"gymnast": forms.HiddenInput(),
|
||||
"single_leg_stability_right": forms.NumberInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "x",
|
||||
"min": "0",
|
||||
"max": "3",
|
||||
}
|
||||
),
|
||||
"single_leg_stability_left": forms.NumberInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "x",
|
||||
"min": "0",
|
||||
"max": "3",
|
||||
}
|
||||
),
|
||||
"overhead_squat": forms.SelectMultiple(attrs={"class": "selectpicker"}),
|
||||
"single_leg_drop_jump": forms.SelectMultiple(attrs={"class": "selectpicker"}),
|
||||
}
|
||||
|
||||
gymnast_related = forms.CharField(
|
||||
required=False,
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Searching gymnast…",
|
||||
"data-ref": "#id_gymnast",
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class WellBeingForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = WellBeing
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
# Generated by Django 4.2 on 2023-08-22 11:59
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import ultron.tools.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("people", "0008_alter_gymnast_orientation"),
|
||||
("followup", "0044_alter_injury_injury_type_alter_injury_location"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="OverheadSquat",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("label", models.CharField(max_length=100)),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "QualityOfMovement - OverheadSquat",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="QualityOfMovement",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"date",
|
||||
models.DateField(
|
||||
default=ultron.tools.models.get_default_date,
|
||||
verbose_name="Date",
|
||||
),
|
||||
),
|
||||
("season", models.CharField(editable=False, max_length=9)),
|
||||
("week_number", models.PositiveSmallIntegerField(editable=False)),
|
||||
(
|
||||
"sl_stability_right",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="Single leg stability right"
|
||||
),
|
||||
),
|
||||
(
|
||||
"sl_stability_left",
|
||||
models.PositiveSmallIntegerField(
|
||||
verbose_name="Single leg stability right"
|
||||
),
|
||||
),
|
||||
(
|
||||
"gymnast",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="qualities_of_movement",
|
||||
to="people.gymnast",
|
||||
),
|
||||
),
|
||||
(
|
||||
"overhead_squat",
|
||||
models.ManyToManyField(
|
||||
related_name="qualities_of_movement",
|
||||
to="followup.sideplanklegraise",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Quality Of Movement",
|
||||
"verbose_name_plural": "Qualities Of Movement",
|
||||
},
|
||||
),
|
||||
]
|
|
@ -0,0 +1,44 @@
|
|||
# Generated by Django 4.2 on 2023-10-01 11:08
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("followup", "0045_overheadsquat_qualityofmovement"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="DropJump",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("label", models.CharField(max_length=100)),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "QualityOfMovement - Drop Jump",
|
||||
},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="qualityofmovement",
|
||||
name="overhead_squat",
|
||||
field=models.ManyToManyField(
|
||||
related_name="qualities_of_movement", to="followup.overheadsquat"
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="qualityofmovement",
|
||||
name="sl_drop_jump",
|
||||
field=models.ManyToManyField(
|
||||
related_name="qualities_of_movement", to="followup.dropjump"
|
||||
),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 4.2 on 2023-10-01 11:13
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("followup", "0046_dropjump_alter_qualityofmovement_overhead_squat_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name="dropjump",
|
||||
options={"verbose_name": "QoM - Drop Jump"},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name="overheadsquat",
|
||||
options={"verbose_name": "QoM - OverheadSquat"},
|
||||
),
|
||||
]
|
|
@ -0,0 +1,27 @@
|
|||
# Generated by Django 4.2 on 2023-10-03 09:51
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("followup", "0047_alter_dropjump_options_alter_overheadsquat_options"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name="qualityofmovement",
|
||||
old_name="sl_drop_jump",
|
||||
new_name="single_leg_drop_jump",
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name="qualityofmovement",
|
||||
old_name="sl_stability_left",
|
||||
new_name="single_leg_stability_left",
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name="qualityofmovement",
|
||||
old_name="sl_stability_right",
|
||||
new_name="single_leg_stability_right",
|
||||
),
|
||||
]
|
|
@ -624,3 +624,54 @@ class Stability(Seasonisable):
|
|||
side_plank_leg_raise = models.ManyToManyField(
|
||||
SidePlankLegRaise, related_name="stabilitytests", symmetrical=False
|
||||
)
|
||||
|
||||
|
||||
class OverheadSquat(models.Model):
|
||||
""" """
|
||||
|
||||
class Meta:
|
||||
verbose_name = "QoM - OverheadSquat"
|
||||
|
||||
label = models.CharField(max_length=100, null=False, blank=False)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.label}"
|
||||
|
||||
|
||||
class DropJump(models.Model):
|
||||
""" """
|
||||
|
||||
class Meta:
|
||||
verbose_name = "QoM - Drop Jump"
|
||||
|
||||
label = models.CharField(max_length=100, null=False, blank=False)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.label}"
|
||||
|
||||
|
||||
class QualityOfMovement(Seasonisable):
|
||||
"""Classe représentant la qualité de mouvement"""
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Quality Of Movement"
|
||||
verbose_name_plural = "Qualities Of Movement"
|
||||
|
||||
gymnast = models.ForeignKey(
|
||||
Gymnast, on_delete=models.CASCADE, related_name="qualities_of_movement"
|
||||
)
|
||||
overhead_squat = models.ManyToManyField(
|
||||
OverheadSquat, related_name="qualities_of_movement", symmetrical=False
|
||||
)
|
||||
single_leg_drop_jump = models.ManyToManyField(
|
||||
DropJump, related_name="qualities_of_movement", symmetrical=False
|
||||
)
|
||||
single_leg_stability_right = models.PositiveSmallIntegerField(
|
||||
verbose_name="Single leg stability right"
|
||||
)
|
||||
single_leg_stability_left = models.PositiveSmallIntegerField(
|
||||
verbose_name="Single leg stability right"
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.gymnast} - {self.date}: {self.overhead_squat}"
|
||||
|
|
|
@ -91,26 +91,6 @@ urlpatterns = [
|
|||
),
|
||||
#
|
||||
#
|
||||
# STABILITY
|
||||
path(r"stability/", views.stability_listing, name="stability_list"),
|
||||
path(r"stability/gymnast/<int:gymnast_id>/", views.stability_listing, name="stability_list"),
|
||||
# path(r"stability/search/", views.injury_listing, name="stability_search"),
|
||||
path(r"stability/add/", views.stability_create_or_update, name="stability_create"),
|
||||
path(
|
||||
r"stability/add/<int:gymnast_id>/",
|
||||
views.stability_create_or_update,
|
||||
name="stability_create_for_gymnast",
|
||||
),
|
||||
# path(
|
||||
# r"stability/edit/<int:injury_id>/",
|
||||
# views.injury_create_or_update,
|
||||
# name="injury_update",
|
||||
# ),
|
||||
path(
|
||||
r"stability/<int:stability_id>/", views.stability_detail, name="stability_details"
|
||||
),
|
||||
#
|
||||
#
|
||||
# WELLBEING
|
||||
path(r"wellbeing/", views.wellbeing_listing, name="wellbeing_list"),
|
||||
path(
|
||||
|
@ -136,6 +116,52 @@ urlpatterns = [
|
|||
),
|
||||
#
|
||||
#
|
||||
# STABILITY
|
||||
path(r"stability/", views.stability_listing, name="stability_list"),
|
||||
path(r"stability/gymnast/<int:gymnast_id>/", views.stability_listing, name="stability_list_for_gymnast"),
|
||||
# path(r"stability/search/", views.injury_listing, name="stability_search"),
|
||||
path(r"stability/add/", views.stability_create_or_update, name="stability_create"),
|
||||
path(
|
||||
r"stability/add/<int:gymnast_id>/",
|
||||
views.stability_create_or_update,
|
||||
name="stability_create_for_gymnast",
|
||||
),
|
||||
path(
|
||||
r"stability/edit/<int:stability_id>/",
|
||||
views.stability_create_or_update,
|
||||
name="stability_update",
|
||||
),
|
||||
path(
|
||||
r"stability/<int:stability_id>/", views.stability_detail, name="stability_details"
|
||||
),
|
||||
#
|
||||
#
|
||||
# QUALITY OF MOVEMENT
|
||||
path(r"quality_of_movement/", views.quality_of_movement_listing, name="quality_of_movement_list"),
|
||||
path(
|
||||
r"quality_of_movement/gymnast/<int:gymnast_id>/",
|
||||
views.quality_of_movement_listing,
|
||||
name="quality_of_movement_list_for_gymnast"
|
||||
),
|
||||
# path(r"stability/search/", views.injury_listing, name="quality_of_movement_search"),
|
||||
path(r"quality_of_movement/add/", views.quality_of_movement_create_or_update, name="quality_of_movement_create"),
|
||||
path(
|
||||
r"quality_of_movement/add/<int:gymnast_id>/",
|
||||
views.quality_of_movement_create_or_update,
|
||||
name="quality_of_movement_create_for_gymnast",
|
||||
),
|
||||
path(
|
||||
r"quality_of_movement/edit/<int:quality_of_movement_id>/",
|
||||
views.quality_of_movement_create_or_update,
|
||||
name="quality_of_movement_update",
|
||||
),
|
||||
path(
|
||||
r"quality_of_movement/<int:quality_of_movement_id>/",
|
||||
views.quality_of_movement_detail,
|
||||
name="quality_of_movement_details"
|
||||
),
|
||||
#
|
||||
#
|
||||
# HEIGH/WEIGHT
|
||||
path(
|
||||
r"heightweight/gymnast/<int:gymnast_id>/",
|
||||
|
|
|
@ -22,6 +22,7 @@ from .models import (
|
|||
LearnedSkill,
|
||||
HeightWeight,
|
||||
SeasonInformation,
|
||||
QualityOfMovement,
|
||||
NumberOfRoutineDone,
|
||||
)
|
||||
|
||||
|
@ -35,6 +36,7 @@ from .forms import (
|
|||
WellBeingForm,
|
||||
HeightWeightForm,
|
||||
LearnedSkillForm,
|
||||
QualityOfMovementForm,
|
||||
SeasonInformationForm,
|
||||
NumberOfRoutineDoneForm,
|
||||
)
|
||||
|
@ -813,3 +815,71 @@ def stability_create_or_update(request, stability_id=None, gymnast_id=None):
|
|||
form = StabilityForm(instance=stability, initial=data)
|
||||
context = {"form": form, "stability_id": stability_id}
|
||||
return render(request, "followup/stabilities/create.html", context)
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def quality_of_movement_listing(request, gymnast_id=None):
|
||||
"""Liste toutes les records de la table Quality of Movement"""
|
||||
|
||||
if gymnast_id is not None:
|
||||
gymnast = Gymnast.objects.get(pk=gymnast_id)
|
||||
quality_of_movement_list = QualityOfMovement.objects.filter(gymnast=gymnast_id)
|
||||
else:
|
||||
quality_of_movement_list = QualityOfMovement.objects.all()
|
||||
gymnast = None
|
||||
|
||||
context = {"quality_of_movement_list": quality_of_movement_list, "gymnast": gymnast}
|
||||
return render(request, "followup/quality_of_movement/list.html", context)
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def quality_of_movement_detail(request, quality_of_movement_id):
|
||||
"""
|
||||
Récupère toutes les informations d'une Quality of Movement.
|
||||
"""
|
||||
quality_of_movement = get_object_or_404(QualityOfMovement, pk=quality_of_movement_id)
|
||||
qof_overhead_squat = quality_of_movement.overhead_squat.all()
|
||||
qof_single_leg_drop_jump = quality_of_movement.single_leg_drop_jump.all()
|
||||
|
||||
context = {
|
||||
"quality_of_movement": quality_of_movement,
|
||||
"qof_overhead_squat": qof_overhead_squat,
|
||||
"qof_single_leg_drop_jump": qof_single_leg_drop_jump
|
||||
}
|
||||
return render(request, "followup/quality_of_movement/details.html", context)
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["GET", "POST"])
|
||||
def quality_of_movement_create_or_update(request, quality_of_movement_id=None, gymnast_id=None):
|
||||
"""
|
||||
Récupère toutes les informations d'une stability.
|
||||
"""
|
||||
if quality_of_movement_id:
|
||||
quality_of_movement = get_object_or_404(QualityOfMovement, pk=quality_of_movement_id)
|
||||
data = {
|
||||
"gymnast_related": quality_of_movement.gymnast,
|
||||
}
|
||||
else:
|
||||
quality_of_movement = None
|
||||
data = None
|
||||
if gymnast_id is not None:
|
||||
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
|
||||
data = {"gymnast": gymnast_id, "gymnast_related": str(gymnast)}
|
||||
|
||||
if request.method == "POST":
|
||||
form = QualityOfMovementForm(request.POST, instance=quality_of_movement)
|
||||
|
||||
if form.is_valid():
|
||||
quality_of_movement = form.save()
|
||||
return HttpResponseRedirect(
|
||||
reverse("quality_of_movement_details", args=(quality_of_movement.pk,))
|
||||
)
|
||||
else:
|
||||
return render(request, "followup/quality_of_movement/create.html", {"form": form})
|
||||
|
||||
form = QualityOfMovementForm(instance=quality_of_movement, initial=data)
|
||||
context = {"form": form, "quality_of_movement_id": quality_of_movement_id}
|
||||
return render(request, "followup/quality_of_movement/create.html", context)
|
||||
|
|
|
@ -2,18 +2,11 @@ from django.contrib.auth.decorators import login_required
|
|||
from django.contrib.auth.models import Group
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
from django.db.models import (
|
||||
BooleanField,
|
||||
IntegerField,
|
||||
ExpressionWrapper,
|
||||
Q,
|
||||
F,
|
||||
Avg,
|
||||
Sum,
|
||||
)
|
||||
from django.db.models.functions import TruncDay
|
||||
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.views.decorators.http import require_http_methods
|
||||
|
@ -26,7 +19,7 @@ from weasyprint import HTML, CSS
|
|||
# from weasyprint.fonts import FontConfiguration
|
||||
|
||||
import pendulum
|
||||
from datetime import date, datetime, timedelta
|
||||
from datetime import date, timedelta
|
||||
from statistics import mean
|
||||
|
||||
from ultron.followup.models import Event
|
||||
|
@ -38,15 +31,16 @@ from ultron.followup.models import (
|
|||
Point,
|
||||
Chrono,
|
||||
Injury,
|
||||
Stability,
|
||||
WellBeing,
|
||||
LearnedSkill,
|
||||
HeightWeight,
|
||||
SeasonInformation,
|
||||
NumberOfRoutineDone,
|
||||
QualityOfMovement,
|
||||
)
|
||||
|
||||
from ultron.followup.models import (
|
||||
CATEGORY_CHOICES,
|
||||
LEARNING_STEP_CHOICES,
|
||||
)
|
||||
|
||||
|
@ -62,6 +56,8 @@ from ultron.tools.date_week_transition import (
|
|||
from .models import Gymnast
|
||||
from .forms import GymnastForm, UserForm
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["POST"])
|
||||
|
@ -251,16 +247,20 @@ def gymnast_display_physiological(request, gymnast_id):
|
|||
"""
|
||||
Renvoie les listes des tailles/poids, état d'esprit et accidents.
|
||||
"""
|
||||
injuries_list = Injury.objects.filter(gymnast=gymnast_id).order_by("date")
|
||||
wellbeing_list = WellBeing.objects.filter(gymnast=gymnast_id).order_by("date")
|
||||
injuries_list = Injury.objects.filter(gymnast=gymnast_id).order_by("date")[:10]
|
||||
wellbeing_list = WellBeing.objects.filter(gymnast=gymnast_id).order_by("date")[:10]
|
||||
height_weight_list = HeightWeight.objects.filter(gymnast=gymnast_id).order_by(
|
||||
"date"
|
||||
)
|
||||
)[:10]
|
||||
stability_list = Stability.objects.filter(gymnast=gymnast_id).order_by("date")[:10]
|
||||
quality_of_movement_list = QualityOfMovement.objects.filter(gymnast=gymnast_id).order_by("date")[:10]
|
||||
|
||||
context = {
|
||||
"injuries_list": injuries_list,
|
||||
"wellbeing_list": wellbeing_list,
|
||||
"stability_list": stability_list,
|
||||
"height_weight_list": height_weight_list,
|
||||
"quality_of_movement_list": quality_of_movement_list,
|
||||
"gymnast_id": gymnast_id,
|
||||
}
|
||||
return render(request, "people/gymnasts/tabs/tab_physiological.html", context)
|
||||
|
|
Loading…
Reference in New Issue