Renaming accident to injury
This commit is contained in:
parent
d66a3f419e
commit
04dcbc7ddb
|
@ -79,7 +79,7 @@
|
|||
{% menuitem 'routine_list' 'tim-icons icon-components' 'Routines' %}
|
||||
{% menuitem 'event_list' 'fal fa-calendar-alt' 'Events' %}
|
||||
{% if request.user|has_group:"trainer" %}
|
||||
{% menuitem 'accident_list' 'fal fa-comment-alt-medical' 'Injuries' %}
|
||||
{% menuitem 'injury_list' 'fal fa-comment-alt-medical' 'Injuries' %}
|
||||
{% endif %}
|
||||
{% menuitem 'place_list' 'fal fa-map-marked-alt' 'Places' %}
|
||||
{% if request.user|has_group:"trainer" %}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<h4>Injuries</h4>
|
||||
</div>
|
||||
<div class="card-body pt-0 pb-0">
|
||||
{% if accident_list %}
|
||||
{% if injury_list %}
|
||||
<div class="card-body pl-0 pt-0 pr-0">
|
||||
<table class="table table-striped table-condensed tablesorter mb-1">
|
||||
<thead>
|
||||
|
@ -16,14 +16,14 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for accident in accident_list %}
|
||||
{% for accident in injury_list %}
|
||||
<tr>
|
||||
<td class="text-left">
|
||||
<a href="{% url 'accident_update' accident.id %}">
|
||||
<a href="{% url 'injury_update' accident.id %}">
|
||||
<span class="tim-icons icon-pencil text-warning"></span>
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center"><a href="{% url 'accident_details' accident.id %}">{{ accident.date | date:"d-m-Y" }}</a></td>
|
||||
<td class="text-center"><a href="{% url 'injury_details' accident.id %}">{{ accident.date | date:"d-m-Y" }}</a></td>
|
||||
<td class="text-left"><a href="{% url 'skill_details' accident.skill.id %}">{{ accident.skill }}</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -35,7 +35,7 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
<div class="card-footer text-right text-muted pt-0">
|
||||
<a href="{% url 'accident_create_for_gymnast' gymnastid %}">
|
||||
<a href="{% url 'injury_create_for_gymnast' gymnastid %}">
|
||||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
|
|
|
@ -70,8 +70,8 @@
|
|||
<h4>Injuries</h4>
|
||||
</div>
|
||||
<div class="card-body pt-0 pb-0">
|
||||
{% if accident_list %}
|
||||
<table class="table tablesorter table-striped table-condensed" id="accident_table">
|
||||
{% if injury_list %}
|
||||
<table class="table tablesorter table-striped table-condensed" id="injury_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 3%"></th>
|
||||
|
@ -81,14 +81,14 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for accident in accident_list %}
|
||||
{% for accident in injury_list %}
|
||||
<tr>
|
||||
<td class="text-left">
|
||||
<a href="{% url 'accident_update' accident.id %}">
|
||||
<a href="{% url 'injury_update' accident.id %}">
|
||||
<span class="tim-icons icon-pencil text-warning"></span>
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center"><a href="{% url 'accident_details' accident.id %}">{{ accident.date | date:"d-m-Y" }}</a></td>
|
||||
<td class="text-center"><a href="{% url 'injury_details' accident.id %}">{{ accident.date | date:"d-m-Y" }}</a></td>
|
||||
<td class="text-left">{% if accident.skill %}<a href="{% url 'skill_details' accident.skill.id %}">{{ accident.skill }}</a>{% else %}-{% endif %}</td>
|
||||
<td class="text-left">{{ accident.nb_week_off }}</td>
|
||||
</tr>
|
||||
|
@ -96,11 +96,11 @@
|
|||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="text-muted">No accident known for this gymnast.</p>
|
||||
<p class="text-muted">No injury known for this gymnast.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-footer text-right text-muted pt-0">
|
||||
<a href="{% url 'accident_create_for_gymnast' gymnast_id %}">
|
||||
<a href="{% url 'injury_create_for_gymnast' gymnast_id %}">
|
||||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||||
<i class="fas fa-plus"></i>
|
||||
</button>
|
||||
|
|
|
@ -94,7 +94,7 @@ def home(request):
|
|||
Q(wellbeings__created_at__gt=request.user.last_login)
|
||||
| Q(points__created_at__gt=request.user.last_login)
|
||||
| Q(chronos__created_at__gt=request.user.last_login)
|
||||
| Q(accident__created_at__gt=request.user.last_login)
|
||||
| Q(injuries__created_at__gt=request.user.last_login)
|
||||
| Q(known_skills__created_at__gt=request.user.last_login)
|
||||
).distinct()
|
||||
|
||||
|
@ -104,7 +104,7 @@ def home(request):
|
|||
| Q(wellbeings__created_at__gte=limit_date)
|
||||
| Q(points__created_at__gte=limit_date)
|
||||
| Q(chronos__created_at__gte=limit_date)
|
||||
| Q(accident__created_at__gte=limit_date)
|
||||
| Q(injuries__created_at__gte=limit_date)
|
||||
| Q(known_skills__created_at__gte=limit_date)
|
||||
).distinct()
|
||||
|
||||
|
|
|
@ -54,21 +54,21 @@ class URLTestCase(TestCase):
|
|||
|
||||
# Injury URL
|
||||
self.assertEqual(
|
||||
resolve("/follow-up/injury/search/").view_name, "accident_search"
|
||||
resolve("/follow-up/injury/search/").view_name, "injury_search"
|
||||
)
|
||||
self.assertEqual(resolve("/follow-up/injury/").view_name, "accident_list")
|
||||
self.assertEqual(resolve("/follow-up/injury/").view_name, "injury_list")
|
||||
self.assertEqual(
|
||||
resolve("/follow-up/injury/add/").view_name, "accident_create"
|
||||
resolve("/follow-up/injury/add/").view_name, "injury_create"
|
||||
)
|
||||
self.assertEqual(
|
||||
resolve("/follow-up/injury/add/1/").view_name,
|
||||
"accident_create_for_gymnast",
|
||||
"injury_create_for_gymnast",
|
||||
)
|
||||
self.assertEqual(
|
||||
resolve("/follow-up/injury/edit/1/").view_name, "accident_update"
|
||||
resolve("/follow-up/injury/edit/1/").view_name, "injury_update"
|
||||
)
|
||||
self.assertEqual(
|
||||
resolve("/follow-up/injury/1/").view_name, "accident_details"
|
||||
resolve("/follow-up/injury/1/").view_name, "injury_details"
|
||||
)
|
||||
|
||||
# Mindstate URL
|
||||
|
|
|
@ -73,21 +73,21 @@ urlpatterns = [
|
|||
#
|
||||
#
|
||||
# Injury
|
||||
path(r"injury/search/", views.accident_listing, name="accident_search"),
|
||||
path(r"injury/", views.accident_listing, name="accident_list"),
|
||||
path(r"injury/add/", views.accident_create_or_update, name="accident_create"),
|
||||
path(r"injury/search/", views.injury_listing, name="injury_search"),
|
||||
path(r"injury/", views.injury_listing, name="injury_list"),
|
||||
path(r"injury/add/", views.injury_create_or_update, name="injury_create"),
|
||||
path(
|
||||
r"injury/add/<int:gymnast_id>/",
|
||||
views.accident_create_or_update,
|
||||
name="accident_create_for_gymnast",
|
||||
views.injury_create_or_update,
|
||||
name="injury_create_for_gymnast",
|
||||
),
|
||||
path(
|
||||
r"injury/edit/<int:accident_id>/",
|
||||
views.accident_create_or_update,
|
||||
name="accident_update",
|
||||
r"injury/edit/<int:injury_id>/",
|
||||
views.injury_create_or_update,
|
||||
name="injury_update",
|
||||
),
|
||||
path(
|
||||
r"injury/<int:accident_id>/", views.accident_detail, name="accident_details"
|
||||
r"injury/<int:injury_id>/", views.injury_detail, name="injury_details"
|
||||
),
|
||||
#
|
||||
#
|
||||
|
|
|
@ -339,7 +339,7 @@ def score_listing(request, gymnast_id=None):
|
|||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def accident_listing(request):
|
||||
def injury_listing(request):
|
||||
"""
|
||||
Récupère la liste des accidents.
|
||||
Si c'est un gymnaste qui est connecté, il ne peut récupérer que la liste de ses accidents.
|
||||
|
@ -350,31 +350,31 @@ def accident_listing(request):
|
|||
if request.user.groups.filter(name="trainer").exists():
|
||||
pattern = request.GET.get("pattern", None)
|
||||
if pattern:
|
||||
accident_list = Injury.objects.filter(
|
||||
injury_list = Injury.objects.filter(
|
||||
Q(gymnast__last_name__icontains=pattern)
|
||||
| Q(gymnast__first_name__icontains=pattern)
|
||||
)
|
||||
else:
|
||||
accident_list = Injury.objects.all()
|
||||
injury_list = Injury.objects.all()
|
||||
else:
|
||||
accident_list = Injury.objects.filter(
|
||||
injury_list = Injury.objects.filter(
|
||||
Q(gymnast__last_name=request.user.last_name)
|
||||
& Q(gymnast__first_name=request.user.first_name)
|
||||
)
|
||||
|
||||
context = {"accident_list": accident_list}
|
||||
context = {"injury_list": injury_list}
|
||||
return render(request, "followup/injuries/list.html", context)
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["GET", "POST"])
|
||||
def accident_create_or_update(request, accident_id=None, gymnast_id=None):
|
||||
def injury_create_or_update(request, injury_id=None, gymnast_id=None):
|
||||
"""
|
||||
Formulaire de création d'un nouvel accident.
|
||||
"""
|
||||
|
||||
if accident_id:
|
||||
accident = get_object_or_404(Injury, pk=accident_id)
|
||||
if injury_id:
|
||||
accident = get_object_or_404(Injury, pk=injury_id)
|
||||
data = {
|
||||
"gymnast_related": accident.gymnast,
|
||||
"skill_related": accident.skill,
|
||||
|
@ -392,23 +392,23 @@ def accident_create_or_update(request, accident_id=None, gymnast_id=None):
|
|||
if form.is_valid():
|
||||
accident = form.save()
|
||||
return HttpResponseRedirect(
|
||||
reverse("accident_details", args=(accident.pk,))
|
||||
reverse("injury_details", args=(accident.pk,))
|
||||
)
|
||||
else:
|
||||
return render(request, "followup/injuries/create.html", {"form": form})
|
||||
|
||||
form = InjuryForm(instance=accident, initial=data)
|
||||
context = {"form": form, "accident_id": accident_id}
|
||||
context = {"form": form, "injury_id": injury_id}
|
||||
return render(request, "followup/injuries/create.html", context)
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def accident_detail(request, accident_id):
|
||||
def injury_detail(request, injury_id):
|
||||
"""
|
||||
Récupère toutes les informations d'un accident.
|
||||
"""
|
||||
accident = get_object_or_404(Injury, pk=accident_id)
|
||||
accident = get_object_or_404(Injury, pk=injury_id)
|
||||
return render(request, "followup/injuries/details.html", {"accident": accident})
|
||||
|
||||
|
||||
|
|
|
@ -240,8 +240,8 @@ def gymnast_display_accident(request, gymnast_id):
|
|||
"""
|
||||
Renvoie la liste des accidents d'un gymnaste.
|
||||
"""
|
||||
accident_list = Injury.objects.filter(gymnast=gymnast_id)
|
||||
context = {"accident_list": accident_list, "gymnast_id": gymnast_id}
|
||||
injury_list = Injury.objects.filter(gymnast=gymnast_id)
|
||||
context = {"injury_list": injury_list, "gymnast_id": gymnast_id}
|
||||
return render(request, "people/gymnasts/list_accident.html", context)
|
||||
|
||||
|
||||
|
@ -251,14 +251,14 @@ def gymnast_display_physiological(request, gymnast_id):
|
|||
"""
|
||||
Renvoie les listes des tailles/poids, état d'esprit et accidents.
|
||||
"""
|
||||
accident_list = Injury.objects.filter(gymnast=gymnast_id).order_by("date")
|
||||
injury_list = Injury.objects.filter(gymnast=gymnast_id).order_by("date")
|
||||
wellbeing_list = WellBeing.objects.filter(gymnast=gymnast_id).order_by("date")
|
||||
height_weight_list = HeightWeight.objects.filter(gymnast=gymnast_id).order_by(
|
||||
"date"
|
||||
)
|
||||
|
||||
context = {
|
||||
"accident_list": accident_list,
|
||||
"injury_list": injury_list,
|
||||
"wellbeing_list": wellbeing_list,
|
||||
"height_weight_list": height_weight_list,
|
||||
"gymnast_id": gymnast_id,
|
||||
|
|
Loading…
Reference in New Issue