add plan functionnalities
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
35d376717b
commit
2e23a46277
|
@ -50,6 +50,7 @@ urlpatterns = [
|
|||
# Objective management
|
||||
path(r"skill/", include(ultron.objective.urls.skill_urlpatterns)),
|
||||
path(r"routine/", include(ultron.objective.urls.routine_urlpatterns)),
|
||||
path(r"plan/", include(ultron.objective.urls.plan_urlpatterns)),
|
||||
|
||||
# Planning management
|
||||
path(r"event/", include(ultron.planning.urls.event_urlpatterns)),
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-8 col-xl-8">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="">{% if plan_id %}Edit{% else %}Add{% endif %} an objective</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{% if plan_id %}{% url 'plan_update' plan_id %}{% else %}{% url 'plan_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">Date *</label>
|
||||
<div class="col-sm-6 col-md-5 col-lg-4 col-xl-2 {% 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_gymnast" class="col-4 col-sm-3 col-form-label">Gymnast *</label>
|
||||
<div class="col-8 col-md-9 col-lg-6 {% if form.jumper.errors %}has-danger{% endif %}">
|
||||
{{ 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 %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_educative" class="col-4 col-sm-3 col-form-label">Skill *</label>
|
||||
<div class="col-8 col-sm-8 col-md-6 col-lg-6 col-xl-6 {% if form.educative.errors %}has-danger{% endif %}">
|
||||
{{ form.educative }}
|
||||
{{ form.educative_related }}
|
||||
{% if form.educative.errors %} <span class="btn btn-sm btn-danger-outline">{% for error in form.educative.errors %}{{error}}{% endfor %}</span>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" value="Save" class="btn btn-fill btn-warning" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block footerscript %}
|
||||
<script type="text/javascript" >
|
||||
$(function(){
|
||||
|
||||
$('#id_date').datetimepicker({
|
||||
format: 'YYYY-MM-DD'
|
||||
});
|
||||
blackDashboard.initDateTimePicker();
|
||||
|
||||
$('#id_gymnast_related').autocomplete({
|
||||
source: function(request, response) {
|
||||
$.ajax({
|
||||
url: '/gymnast/lookup/?pattern=' + $('#id_gymnast_related').val(),
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.length != 0) {
|
||||
response($.map(data, function(item) {
|
||||
return {
|
||||
label: item.Name,
|
||||
value: item.Name,
|
||||
gymnastid: item.ID
|
||||
}
|
||||
}))
|
||||
} else {
|
||||
response([{ label: 'No result found.', value: '' }]);
|
||||
};
|
||||
},
|
||||
|
||||
error: function (exception) {
|
||||
console.log(exception);
|
||||
}
|
||||
});
|
||||
},
|
||||
minLength: 3,
|
||||
select: function (event, ui) {
|
||||
$($(this).data('ref')).val(ui.item.gymnastid);
|
||||
}
|
||||
});
|
||||
|
||||
$('#id_educative_related').autocomplete({
|
||||
source: function(request, response) {
|
||||
$.ajax({
|
||||
url: '/skill/lookup/?pattern=' + $('#id_educative_related').val(),
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.length != 0) {
|
||||
response($.map(data, function(item) {
|
||||
return {
|
||||
label: item.Name,
|
||||
value: item.Name,
|
||||
skillid: item.ID
|
||||
}
|
||||
}))
|
||||
} else {
|
||||
response([{ label: 'No result found.', value: '' }]);
|
||||
};
|
||||
},
|
||||
|
||||
error: function (exception) {
|
||||
console.log(exception);
|
||||
}
|
||||
});
|
||||
},
|
||||
minLength: 3,
|
||||
select: function (event, ui) {
|
||||
$($(this).data('ref')).val(ui.item.skillid);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -38,23 +38,8 @@
|
|||
<li><b>Routine</b> : {% if best_routine %}<b>{{ best_routine.0.tof }}</b> ({{ best_routine.0.date | date:"d-m-Y" }}){% else %} (no information){% endif %}</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- <div class="row">
|
||||
<i class="fal fa-stethoscope"></i>
|
||||
<div class="col-3">
|
||||
<a href="{% url 'chrono_create_for_gymnast' gymnast.id %}" class="nav-item dropdown-item">New <i class="far fa-stopwatch"></i></a>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<a href="{% url 'score_create_for_gymnast' gymnast.id %}" class="nav-item dropdown-item">New <i class="fal fa-crosshairs"></i></a>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<a href="{% url 'mindstate_create_for_gymnast' gymnast.id %}" class="nav-item dropdown-item">New <i class="fal fa-file-medical-alt"></i></a>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<a href="{% url 'accident_create_for_gymnast' gymnast.id %}" class="nav-item dropdown-item">New <i class="fal fa-comment-alt-medical"></i></a>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -99,39 +84,29 @@
|
|||
<ul class="nav nav-pills nav-pills-primary nav-pills-icons flex-column">
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link get-info {% if tab is None or tab == 'level' %}active{% endif %}" data-toggle="tab" href="#statistics" data-ref="#statistics" data-url="statistics/" id="display_statistics">
|
||||
<a class="nav-link get-info{% if tab is None or tab == 'level' %} active{% endif %}" data-toggle="tab" href="#statistics" data-ref="#statistics" data-url="statistics/" id="display_statistics">
|
||||
<i class="tim-icons icon-sound-wave"></i> Level
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link get-info {% if tab == 'routine' %}active{% endif %}" data-toggle="tab" href="#routine" data-ref="#routine" data-url="routine/" id="display_routines">
|
||||
<a class="nav-link get-info{% if tab == 'routine' %} active{% endif %}" data-toggle="tab" href="#routine" data-ref="#routine" data-url="routine/" id="display_routines">
|
||||
<i class="tim-icons icon-components"></i> Routines
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link get-info {% if tab == 'scores' %}active{% endif %}" data-toggle="tab" href="#scores" data-ref="#scores" data-url="scores_chrono/" id="display_scores_chrono">
|
||||
<a class="nav-link get-info{% if tab == 'scores' %} active{% endif %}" data-toggle="tab" href="#scores" data-ref="#scores" data-url="scores_chrono/" id="display_scores_chrono">
|
||||
<i class="fal fa-crosshairs"></i> Scores
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link get-info {% if tab == 'physiological' %}active{% endif %}" data-toggle="tab" href="#physiological" data-ref="#physiological" data-url="physiological/" id="display_physiological">
|
||||
<a class="nav-link get-info{% if tab == 'physiological' %} active{% endif %}" data-toggle="tab" href="#physiological" data-ref="#physiological" data-url="physiological/" id="display_physiological">
|
||||
<i class="fal fa-stethoscope"></i> Physical
|
||||
</a>
|
||||
</li>
|
||||
<!-- <li class="nav-item">
|
||||
<a class="nav-link get-info {% if tab == 'mindstate' %}active{% endif %}" data-toggle="tab" href="#mindstate" data-ref="#mindstate" data-url="mindstate/" id="display_mindstate">
|
||||
<i class="fal fa-file-medical-alt"></i> Mindstates
|
||||
</a>
|
||||
</li> -->
|
||||
<!-- <li class="nav-item">
|
||||
<a class="nav-link get-info {% if tab == 'scores' %}active{% endif %}" data-toggle="tab" href="#accident" data-ref="#accident" data-url="accident/" id="display_accident">
|
||||
<i class="fal fa-comment-alt-medical"></i> Accidents
|
||||
</a>
|
||||
</li> -->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link get-info {% if tab == 'event' %}active{% endif %}" data-toggle="tab" href="#event" data-ref="#event" data-url="event/" id="display_event">
|
||||
<a class="nav-link get-info{% if tab == 'event' %} active{% endif %}" data-toggle="tab" href="#event" data-ref="#event" data-url="event/" id="display_event">
|
||||
<i class="fal fa-calendar-day"></i> Events
|
||||
</a>
|
||||
</li>
|
||||
|
@ -139,19 +114,15 @@
|
|||
</div>
|
||||
<div class="col-12 col-sm-10 col-md-10 col-lg-11">
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane {% if tab is None or tab == 'level' %}active{% endif %}" id="statistics"></div>
|
||||
<div class="tab-pane{% if tab is None or tab == 'level' %} active{% endif %}" id="statistics"></div>
|
||||
|
||||
<div class="tab-pane {% if tab == 'routine' %}active{% endif %}" id="routine"></div>
|
||||
<div class="tab-pane{% if tab == 'routine' %} active{% endif %}" id="routine"></div>
|
||||
|
||||
<div class="tab-pane {% if tab == 'scores' %}active{% endif %}" id="scores"></div>
|
||||
<div class="tab-pane{% if tab == 'scores' %} active{% endif %}" id="scores"></div>
|
||||
|
||||
<div class="tab-pane {% if tab == 'physiological' %}active{% endif %}" id="physiological"></div>
|
||||
|
||||
<!-- <div class="tab-pane {% if tab == 'mindstate' %}active{% endif %}" id="mindstate"></div> -->
|
||||
|
||||
<!-- <div class="tab-pane {% if tab == 'accident' %}active{% endif %}" id="accident"></div> -->
|
||||
<div class="tab-pane{% if tab == 'physiological' %} active{% endif %}" id="physiological"></div>
|
||||
|
||||
<div class="tab-pane {% if tab == 'event' %}active{% endif %}" id="event"></div>
|
||||
<div class="tab-pane{% if tab == 'event' %} active{% endif %}" id="event"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,11 +3,19 @@
|
|||
<div class="col-md-12 pr-0">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
{% if skill_whith_help or skill_not_chained or skill_by_rank or skill_by_level or skill_by_age or unknown_skill %}
|
||||
{% if planified_skill or skill_whith_help or skill_not_chained or skill_by_rank or skill_by_level or skill_by_age or unknown_skill %}
|
||||
<ul class="nav nav-pills nav-pills-warning nav-pills-icons justify-content-center">
|
||||
{% if planified_skill %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if planified_skill %}active{% endif %}" data-toggle="tab" href="#planified_skill">
|
||||
Objectifs ({{ planified_skill|length }})
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if skill_whith_help %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#skill_whith_help">
|
||||
<a class="nav-link {% if skill_whith_help and not planified_skill %}active{% endif %}" data-toggle="tab" href="#skill_whith_help">
|
||||
With help ({{ skill_whith_help|length }})
|
||||
</a>
|
||||
</li>
|
||||
|
@ -15,7 +23,7 @@
|
|||
|
||||
{% if skill_not_chained %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#skill_not_chained">
|
||||
<a class="nav-link {% if skill_not_chained and not skill_whith_help and not planified_skill %}active{% endif %}" data-toggle="tab" href="#skill_not_chained">
|
||||
Not chained ({{ skill_not_chained|length }})
|
||||
</a>
|
||||
</li>
|
||||
|
@ -23,7 +31,7 @@
|
|||
|
||||
{% if skill_by_rank %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#skill_by_rank">
|
||||
<a class="nav-link {% if skill_by_rank and not skill_not_chained and not skill_whith_help and not planified_skill %}active{% endif %}" data-toggle="tab" href="#skill_by_rank">
|
||||
By rank ({{ skill_by_rank|length }})
|
||||
</a>
|
||||
</li>
|
||||
|
@ -31,7 +39,7 @@
|
|||
|
||||
{% if skill_by_level %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#skill_by_level">
|
||||
<a class="nav-link {% if skill_by_level and not skill_by_rank and not skill_not_chained and not skill_whith_help and not planified_skill %}active{% endif %}" data-toggle="tab" href="#skill_by_level">
|
||||
By level ({{ skill_by_level|length }})
|
||||
</a>
|
||||
</li>
|
||||
|
@ -54,8 +62,49 @@
|
|||
{% endif %}
|
||||
</ul>
|
||||
<div class="tab-content tab-space tab-subcategories pt-0 pb-0">
|
||||
{% if planified_skill %}
|
||||
<div class="tab-pane {% if planified_skill %}active{% endif %}" id="planified_skill">
|
||||
<table class="table table-striped table-condensed tablesorter" id="table_planified_skill">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 10%"></th>
|
||||
<th class="header text-left" style="width: 55%">Label</th>
|
||||
<th class="header text-left" style="width: 10%">Deadline</th>
|
||||
<th class="header" style="width: 7%">Diff.</th>
|
||||
<th class="header" style="width: 7%">Level</th>
|
||||
<th class="header" style="width: 7%">Rank</th>
|
||||
<th style="width: 10%">Notation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for skill in planified_skill %}
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="1">
|
||||
<i class="far fa-check"></i>
|
||||
</button>
|
||||
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="2">
|
||||
<i class="far fa-check-double"></i>
|
||||
</button>
|
||||
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="3">
|
||||
<i class="far fa-link"></i>
|
||||
</button>
|
||||
</td>
|
||||
<td class="text-left"><a href="{% url 'skill_details' skill.id %}">{{ skill.long_label }}</a></td>
|
||||
<td>{{ skill.plan_date | date:"d-m-Y" }}</td>
|
||||
<td>{{ skill.difficulty }}</td>
|
||||
<td>{{ skill.level }}</td>
|
||||
<td>{{ skill.rank }}</td>
|
||||
<td>{{ skill.notation }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if skill_whith_help %}
|
||||
<div class="tab-pane active" id="skill_whith_help">
|
||||
<div class="tab-pane {% if skill_whith_help and not planified_skill %}active{% endif %}" id="skill_whith_help">
|
||||
<table class="table table-striped table-condensed tablesorter" id="table-skill-with-help">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -91,7 +140,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if skill_not_chained %}
|
||||
<div class="tab-pane" id="skill_not_chained">
|
||||
<div class="tab-pane {% if skill_not_chained and not skill_whith_help and not planified_skill %}active{% endif %}" id="skill_not_chained">
|
||||
<table class="table table-striped table-condensed tablesorter" id="table-skill-with-help">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -124,12 +173,12 @@
|
|||
{% endif %}
|
||||
|
||||
{% if skill_by_rank %}
|
||||
<div class="tab-pane" id="skill_by_rank">
|
||||
<div class="tab-pane {% if skill_by_rank and not skill_not_chained and not skill_whith_help and not planified_skill %}active{% endif %}" id="skill_by_rank">
|
||||
<table class="table table-striped table-condensed tablesorter" id="table-by-rank">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 10%"></th>
|
||||
<th class="header text-left" style="width: 55%">Label</th>
|
||||
<th style="width: 12%">Actions</th>
|
||||
<th class="header text-left" style="width: 50%">Label</th>
|
||||
<th class="header" style="width: 7%">Diff.</th>
|
||||
<th class="header" style="width: 7%">Level</th>
|
||||
<th class="header" style="width: 7%">Rank</th>
|
||||
|
@ -140,6 +189,11 @@
|
|||
{% for skill in skill_by_rank %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url 'add_skill_for_gymnast' gymnast.id skill.id %}">
|
||||
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon planify_skill">
|
||||
<i class="fal fa-share-all"></i>
|
||||
</button>
|
||||
</a>
|
||||
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="1">
|
||||
<i class="far fa-check"></i>
|
||||
</button>
|
||||
|
@ -163,12 +217,12 @@
|
|||
{% endif %}
|
||||
|
||||
{% if skill_by_level %}
|
||||
<div class="tab-pane" id="skill_by_level">
|
||||
<div class="tab-pane {% if skill_by_level and not skill_by_rank and not skill_not_chained and not skill_whith_help and not planified_skill %}active{% endif %}" id="skill_by_level">
|
||||
<table class="table table-striped table-condensed tablesorter" id="table-by-level">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 10%"></th>
|
||||
<th class="header text-left" style="width: 55%">Label</th>
|
||||
<th style="width: 12%">Actions</th>
|
||||
<th class="header text-left" style="width: 50%">Label</th>
|
||||
<th class="header" style="width: 7%">Diff.</th>
|
||||
<th class="header" style="width: 7%">Level</th>
|
||||
<th class="header" style="width: 7%">Rank</th>
|
||||
|
@ -179,6 +233,9 @@
|
|||
{% for skill in skill_by_level %}
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon planify_skill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="1">
|
||||
<i class="fal fa-share-all"></i>
|
||||
</button>
|
||||
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="1">
|
||||
<i class="far fa-check"></i>
|
||||
</button>
|
||||
|
@ -206,8 +263,8 @@
|
|||
<table class="table table-striped table-condensed tablesorter" id="table-by-age">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 10%"></th>
|
||||
<th class="header text-left" style="width: 55%">Label</th>
|
||||
<th style="width: 12%">Actions</th>
|
||||
<th class="header text-left" style="width: 50%">Label</th>
|
||||
<th class="header" style="width: 7%">Diff.</th>
|
||||
<th class="header" style="width: 7%">Level</th>
|
||||
<th class="header" style="width: 7%">Rank</th>
|
||||
|
@ -218,6 +275,9 @@
|
|||
{% for skill in skill_by_age %}
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon planify_skill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="1">
|
||||
<i class="fal fa-share-all"></i>
|
||||
</button>
|
||||
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="1">
|
||||
<i class="far fa-check"></i>
|
||||
</button>
|
||||
|
@ -245,8 +305,8 @@
|
|||
<table class="table table-striped table-condensed tablesorter" id="table-other">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 10%"></th>
|
||||
<th class="header text-left" style="width: 64%">Label</th>
|
||||
<th style="width: 12%">Actions</th>
|
||||
<th class="header text-left" style="width: 50%">Label</th>
|
||||
<th class="header" style="width: 7%">Diff.</th>
|
||||
<th class="header" style="width: 7%">Level</th>
|
||||
<th class="header" style="width: 7%">Rank</th>
|
||||
|
@ -257,6 +317,9 @@
|
|||
{% for skill in unknown_skill %}
|
||||
<tr>
|
||||
<td>
|
||||
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon planify_skill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="1">
|
||||
<i class="fal fa-share-all"></i>
|
||||
</button>
|
||||
<button type="button" rel="tooltip" class="btn btn-success btn-link btn-sm btn-icon checkUnknownSkill" data-gymnastid="{{ gymnast.id }}" data-skillid="{{ skill.id }}" data-link="1">
|
||||
<i class="far fa-check"></i>
|
||||
</button>
|
||||
|
|
|
@ -15,15 +15,15 @@ class ChronoForm(forms.ModelForm):
|
|||
'gymnast': forms.HiddenInput(),
|
||||
'date': forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control datepicker",
|
||||
"placeholder": date.today().strftime("%Y-%m-%d"),
|
||||
"value": date.today().strftime("%Y-%m-%d"),
|
||||
'class': 'form-control datepicker',
|
||||
'placeholder': date.today().strftime('%Y-%m-%d'),
|
||||
'value': date.today().strftime('%Y-%m-%d'),
|
||||
}
|
||||
),
|
||||
'type': forms.Select(attrs={"class": "form-control"}),
|
||||
'score_type': forms.Select(attrs={"class": "form-control"}),
|
||||
'type': forms.Select(attrs={'class': 'form-control'}),
|
||||
'score_type': forms.Select(attrs={'class': 'form-control'}),
|
||||
'score': forms.TextInput(
|
||||
attrs={"class": "form-control", "placeholder": "xx,xxx"}
|
||||
attrs={'class': 'form-control', 'placeholder': 'xx,xxx'}
|
||||
),
|
||||
'tof': forms.HiddenInput(),
|
||||
}
|
||||
|
@ -49,20 +49,20 @@ class LearnedSkillForm(forms.ModelForm):
|
|||
'skill': forms.HiddenInput(),
|
||||
'date': forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control datepicker",
|
||||
"placeholder": date.today().strftime("%Y-%m-%d"),
|
||||
"value": date.today().strftime("%Y-%m-%d"),
|
||||
'class': 'form-control datepicker',
|
||||
'placeholder': date.today().strftime('%Y-%m-%d'),
|
||||
'value': date.today().strftime('%Y-%m-%d'),
|
||||
}
|
||||
),
|
||||
'cando': forms.Select(attrs={"class": "form-control"}),
|
||||
'cando': forms.Select(attrs={'class': 'form-control'}),
|
||||
}
|
||||
|
||||
gymnast_related = forms.CharField(
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Searching gymnast…",
|
||||
"data-ref": "#id_gymnast",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching gymnast…',
|
||||
'data-ref': '#id_gymnast',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -70,9 +70,9 @@ class LearnedSkillForm(forms.ModelForm):
|
|||
skill_related = forms.CharField(
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Searching skill…",
|
||||
"data-ref": "#id_skill",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching skill…',
|
||||
'data-ref': '#id_skill',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -81,49 +81,49 @@ class LearnedSkillForm(forms.ModelForm):
|
|||
class ScoreForm(forms.ModelForm):
|
||||
class Meta:
|
||||
ROUTINETYPE_CHOICE = (
|
||||
(0, "Routine 1"),
|
||||
(1, "Routine 2"),
|
||||
(2, "Final's routine"),
|
||||
(0, 'Routine 1'),
|
||||
(1, 'Routine 2'),
|
||||
(2, 'Final\'s routine'),
|
||||
)
|
||||
|
||||
model = Point
|
||||
fields = (
|
||||
"gymnast",
|
||||
"event",
|
||||
"routine_type",
|
||||
"point_difficulty",
|
||||
"point_time_of_flight",
|
||||
"point_execution",
|
||||
"point_horizontal_displacement",
|
||||
"penality",
|
||||
"total",
|
||||
'gymnast',
|
||||
'event',
|
||||
'routine_type',
|
||||
'point_difficulty',
|
||||
'point_time_of_flight',
|
||||
'point_execution',
|
||||
'point_horizontal_displacement',
|
||||
'penality',
|
||||
'total',
|
||||
)
|
||||
|
||||
widgets = {
|
||||
"gymnast": forms.HiddenInput(),
|
||||
"event": forms.HiddenInput(),
|
||||
"routine_type": forms.Select(attrs={"class": "form-control"}),
|
||||
"point_execution": forms.NumberInput(
|
||||
attrs={"class": "form-control", "placeholder": "xx,xx",}
|
||||
'gymnast': forms.HiddenInput(),
|
||||
'event': forms.HiddenInput(),
|
||||
'routine_type': forms.Select(attrs={'class': 'form-control'}),
|
||||
'point_execution': forms.NumberInput(
|
||||
attrs={'class': 'form-control', 'placeholder': 'xx,xx',}
|
||||
),
|
||||
"point_difficulty": forms.NumberInput(
|
||||
attrs={"class": "form-control", "placeholder": "xx,xx",}
|
||||
'point_difficulty': forms.NumberInput(
|
||||
attrs={'class': 'form-control', 'placeholder': 'xx,xx',}
|
||||
),
|
||||
"point_time_of_flight": forms.NumberInput(
|
||||
attrs={"class": "form-control", "placeholder": "xx,xx",}
|
||||
'point_time_of_flight': forms.NumberInput(
|
||||
attrs={'class': 'form-control', 'placeholder': 'xx,xx',}
|
||||
),
|
||||
"point_horizontal_displacement": forms.NumberInput(
|
||||
attrs={"class": "form-control", "placeholder": "x,xx",}
|
||||
'point_horizontal_displacement': forms.NumberInput(
|
||||
attrs={'class': 'form-control', 'placeholder': 'x,xx',}
|
||||
),
|
||||
"penality": forms.NumberInput(
|
||||
attrs={"class": "form-control", "placeholder": "xx,xx", "value": "0"}
|
||||
'penality': forms.NumberInput(
|
||||
attrs={'class': 'form-control', 'placeholder': 'xx,xx', 'value': '0'}
|
||||
),
|
||||
"total": forms.TextInput(
|
||||
'total': forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "000,000",
|
||||
"readonly": "readonly",
|
||||
"maxlength": "6",
|
||||
'class': 'form-control',
|
||||
'placeholder': '000,000',
|
||||
'readonly': 'readonly',
|
||||
'maxlength': '6',
|
||||
}
|
||||
),
|
||||
}
|
||||
|
@ -131,18 +131,18 @@ class ScoreForm(forms.ModelForm):
|
|||
gymnast_related = forms.CharField(
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Searching…",
|
||||
"data-ref": "#id_gymnast",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching…',
|
||||
'data-ref': '#id_gymnast',
|
||||
}
|
||||
)
|
||||
)
|
||||
event_related = forms.CharField(
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Searching…",
|
||||
"data-ref": "#id_event",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching…',
|
||||
'data-ref': '#id_event',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -155,20 +155,20 @@ class AccidentForm(forms.ModelForm):
|
|||
widgets = {
|
||||
'date': forms.DateInput(
|
||||
attrs={
|
||||
"class": "form-control datepicker",
|
||||
"placeholder": date.today().strftime("%Y-%m-%d"),
|
||||
"value": date.today().strftime("%Y-%m-%d"),
|
||||
'class': 'form-control datepicker',
|
||||
'placeholder': date.today().strftime('%Y-%m-%d'),
|
||||
'value': date.today().strftime('%Y-%m-%d'),
|
||||
}
|
||||
),
|
||||
'gymnast': forms.HiddenInput(),
|
||||
'skill': forms.HiddenInput(),
|
||||
'nb_week_off': forms.NumberInput(
|
||||
attrs={"class": "form-control", "placeholder": "xx"}
|
||||
attrs={'class': 'form-control', 'placeholder': 'xx'}
|
||||
),
|
||||
'informations': forms.Textarea(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Informations about accident: context (why, where, …), consequencies, …",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Informations about accident: context (why, where, …), consequencies, …',
|
||||
}
|
||||
),
|
||||
}
|
||||
|
@ -176,9 +176,9 @@ class AccidentForm(forms.ModelForm):
|
|||
gymnast_related = forms.CharField(
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Searching gymnast…",
|
||||
"data-ref": "#id_gymnast",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching gymnast…',
|
||||
'data-ref': '#id_gymnast',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -186,9 +186,9 @@ class AccidentForm(forms.ModelForm):
|
|||
required=False,
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Searching skill…",
|
||||
"data-ref": "#id_skill",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching skill…',
|
||||
'data-ref': '#id_skill',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -202,19 +202,19 @@ class MindStateForm(forms.ModelForm):
|
|||
'gymnast': forms.HiddenInput(),
|
||||
'date': forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control datepicker",
|
||||
"placeholder": date.today().strftime("%Y-%m-%d"),
|
||||
"value": date.today().strftime("%Y-%m-%d"),
|
||||
'class': 'form-control datepicker',
|
||||
'placeholder': date.today().strftime('%Y-%m-%d'),
|
||||
'value': date.today().strftime('%Y-%m-%d'),
|
||||
}
|
||||
),
|
||||
'event': forms.HiddenInput(),
|
||||
'score': forms.NumberInput(
|
||||
attrs={"class": "form-control", "placeholder": "xx"}
|
||||
attrs={'class': 'form-control', 'placeholder': 'xx'}
|
||||
),
|
||||
'informations': forms.Textarea(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Informations about the psychological state of mind : context (why, where, …), possible consequencies, …",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Informations about the psychological state of mind : context (why, where, …), possible consequencies, …',
|
||||
}
|
||||
),
|
||||
}
|
||||
|
@ -242,35 +242,33 @@ class MindStateForm(forms.ModelForm):
|
|||
|
||||
|
||||
class GymnastHasRoutineForm(forms.ModelForm):
|
||||
"""
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = GymnastHasRoutine
|
||||
fields = ("gymnast", "routine", "routine_type", "datebegin", "dateend")
|
||||
fields = ('gymnast', 'routine', 'routine_type', 'datebegin', 'dateend')
|
||||
widgets = {
|
||||
"gymnast": forms.HiddenInput(),
|
||||
"routine": forms.HiddenInput(),
|
||||
"routine_type": forms.Select(attrs={"class": "form-control"}),
|
||||
"datebegin": forms.DateInput(attrs={"class": "form-control datepicker",}),
|
||||
"dateend": forms.DateInput(attrs={"class": "form-control datepicker",}),
|
||||
'gymnast': forms.HiddenInput(),
|
||||
'routine': forms.HiddenInput(),
|
||||
'routine_type': forms.Select(attrs={'class': 'form-control'}),
|
||||
'datebegin': forms.DateInput(attrs={'class': 'form-control datepicker',}),
|
||||
'dateend': forms.DateInput(attrs={'class': 'form-control datepicker',}),
|
||||
}
|
||||
|
||||
gymnast_related = forms.CharField(
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Searching gymnast…",
|
||||
"data-ref": "#id_gymnast",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching gymnast…',
|
||||
'data-ref': '#id_gymnast',
|
||||
}
|
||||
)
|
||||
)
|
||||
routine_related = forms.CharField(
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Searching routine…",
|
||||
"data-ref": "#id_routine",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching routine…',
|
||||
'data-ref': '#id_routine',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -287,25 +285,25 @@ class HeightWeightForm(forms.ModelForm):
|
|||
'gymnast': forms.HiddenInput(),
|
||||
'date': forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control datepicker",
|
||||
"placeholder": date.today().strftime("%Y-%m-%d"),
|
||||
"value": date.today().strftime("%Y-%m-%d"),
|
||||
'class': 'form-control datepicker',
|
||||
'placeholder': date.today().strftime('%Y-%m-%d'),
|
||||
'value': date.today().strftime('%Y-%m-%d'),
|
||||
}
|
||||
),
|
||||
'height': forms.NumberInput(
|
||||
attrs={"class": "form-control", "placeholder": "xxx,x"}
|
||||
attrs={'class': 'form-control', 'placeholder': 'xxx,x'}
|
||||
),
|
||||
'weight': forms.NumberInput(
|
||||
attrs={"class": "form-control", "placeholder": "xxx,x"}
|
||||
attrs={'class': 'form-control', 'placeholder': 'xxx,x'}
|
||||
),
|
||||
}
|
||||
|
||||
gymnast_related = forms.CharField(
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Searching gymnast…",
|
||||
"data-ref": "#id_gymnast",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching gymnast…',
|
||||
'data-ref': '#id_gymnast',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
|
|
@ -143,7 +143,7 @@ class RoutineSkillAdmin(admin.ModelAdmin):
|
|||
'routine__long_label',
|
||||
'routine__short_label',
|
||||
)
|
||||
ordering = ('routine',)
|
||||
ordering = ('routine', )
|
||||
|
||||
|
||||
class PlanAdmin(admin.ModelAdmin):
|
||||
|
@ -158,6 +158,7 @@ class PlanAdmin(admin.ModelAdmin):
|
|||
'educative__short_label',
|
||||
)
|
||||
|
||||
|
||||
admin.site.register(TouchPosition, TouchPositionAdmin)
|
||||
admin.site.register(Skill, SkillAdmin)
|
||||
admin.site.register(Routine, RoutineAdmin)
|
||||
|
|
|
@ -1,27 +1,67 @@
|
|||
from django import forms
|
||||
from datetime import date
|
||||
from .models import Routine, RoutineSkill
|
||||
from .models import Routine, RoutineSkill, Plan
|
||||
|
||||
|
||||
class RoutineForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Routine
|
||||
fields = ("long_label", "short_label", "difficulty", "level", "active", 'informations')
|
||||
fields = ('long_label', 'short_label', 'difficulty', 'level', 'active', 'informations')
|
||||
widgets = {
|
||||
# Champs obligatoires de la classe mère.
|
||||
'long_label': forms.TextInput(
|
||||
attrs={"class": "form-control", "placeholder": "Routine's long name"}
|
||||
attrs={'class': 'form-control', 'placeholder': 'Routine\'s long name'}
|
||||
),
|
||||
'short_label': forms.TextInput(
|
||||
attrs={"class": "form-control", "placeholder": "Routine's short name"}
|
||||
attrs={'class': 'form-control', 'placeholder': 'Routine\'s short name'}
|
||||
),
|
||||
'informations': forms.Textarea(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Informations about the psychological state of mind : context (why, where, …), possible consequencies, …",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Informations about the psychological state of mind : context (why, where, …), possible consequencies, …',
|
||||
}
|
||||
),
|
||||
'difficulty': forms.HiddenInput(),
|
||||
'level': forms.HiddenInput(),
|
||||
'active': forms.HiddenInput(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PlanForm(forms.ModelForm):
|
||||
"""
|
||||
Formulaire d'enregistrement d'un couple plan
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
model = Plan
|
||||
fields = ('date', 'gymnast', 'educative')
|
||||
widgets = {
|
||||
'gymnast': forms.HiddenInput(),
|
||||
'educative': forms.HiddenInput(),
|
||||
'date': forms.TextInput(
|
||||
attrs={
|
||||
'class': 'form-control datepicker',
|
||||
'placeholder': date.today().strftime('%Y-%m-%d'),
|
||||
'value': date.today().strftime('%Y-%m-%d'),
|
||||
}
|
||||
),
|
||||
}
|
||||
|
||||
gymnast_related = forms.CharField(
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching gymnast…',
|
||||
'data-ref': '#id_gymnast',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
educative_related = forms.CharField(
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching skill…',
|
||||
'data-ref': '#id_skill',
|
||||
}
|
||||
)
|
||||
)
|
|
@ -291,14 +291,15 @@ class Plan(models.Model):
|
|||
)
|
||||
educative = models.ForeignKey(
|
||||
Educative,
|
||||
verbose_name="Skill",
|
||||
verbose_name="Educative",
|
||||
related_name="plan",
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
date = models.DateField(default=date.today, verbose_name="Date")
|
||||
|
||||
def __str__(self):
|
||||
return "%s - %s" % (
|
||||
return "%s - %s - %s" % (
|
||||
self.gymnast,
|
||||
self.educative.short_label,
|
||||
self.date,
|
||||
)
|
|
@ -39,4 +39,28 @@ routine_urlpatterns = [
|
|||
# ),
|
||||
# path(r"suggest/", views.suggest_routine, name="suggest_routine",),
|
||||
path(r"", views.routine_listing, name="routine_list"),
|
||||
]
|
||||
]
|
||||
|
||||
# Plan
|
||||
plan_urlpatterns = [
|
||||
path(
|
||||
r"add/",
|
||||
views.plan_create_or_update,
|
||||
name="plan_create"
|
||||
),
|
||||
path(
|
||||
r"add/<int:gymnast_id>/",
|
||||
views.plan_create_or_update,
|
||||
name="add_plan_for_gymnast"
|
||||
),
|
||||
path(
|
||||
r"add/<int:gymnast_id>/<int:skill_id>/",
|
||||
views.plan_create_or_update,
|
||||
name="add_skill_for_gymnast"
|
||||
),
|
||||
path(
|
||||
r"edit/<int:plan_id>/",
|
||||
views.plan_create_or_update,
|
||||
name="plan_update",
|
||||
),
|
||||
]
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.urls import reverse
|
|||
|
||||
from ultron.people.models import Gymnast
|
||||
from .models import Skill, Routine, RoutineSkill
|
||||
from .forms import RoutineForm
|
||||
from .forms import RoutineForm, PlanForm
|
||||
|
||||
import simplejson
|
||||
|
||||
|
@ -260,4 +260,51 @@ def link_skill_to_routine(request, routineid, skillid, order):
|
|||
|
||||
return HttpResponse(200, (link, created))
|
||||
# except:
|
||||
# return False
|
||||
# return False
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["GET", "POST"])
|
||||
def plan_create_or_update(request, plan_id=None, gymnast_id=None, skill_id=None):
|
||||
""" Création d'un plan.
|
||||
|
||||
Args:
|
||||
plan_id (int): identifiant d'un plan (classe <Plan>).
|
||||
gymnast_id (int): identifiant d'un gymnaste (classe <Gymnast>).
|
||||
skill_id (int): identifiant d'un skill (classe <Skill>).
|
||||
"""
|
||||
|
||||
if plan_id:
|
||||
plan = get_object_or_404(Plan, pk=plan_id)
|
||||
data = {
|
||||
'gymnast': plan.gymnast.id,
|
||||
'gymnast_related': str(chrono.gymnast),
|
||||
'skill': plan.skill.id,
|
||||
'skill_related': str(plan.skill),
|
||||
}
|
||||
else:
|
||||
plan = None
|
||||
data = {}
|
||||
|
||||
if gymnast_id:
|
||||
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
|
||||
data['gymnast'] = gymnast_id
|
||||
data['gymnast_related'] = str(gymnast)
|
||||
|
||||
if skill_id:
|
||||
skill = get_object_or_404(Skill, pk=skill_id)
|
||||
data['educative'] = skill_id
|
||||
data['educative_related'] = str(skill)
|
||||
|
||||
if request.method == 'POST':
|
||||
form = PlanForm(request.POST, instance=plan)
|
||||
|
||||
if form.is_valid():
|
||||
plan = form.save()
|
||||
else:
|
||||
print(form.errors)
|
||||
else:
|
||||
form = PlanForm(instance=plan, initial=data)
|
||||
|
||||
context = {"form": form, "plan_id": plan_id}
|
||||
return render(request, "objectives/plan/create.html", context)
|
|
@ -1,4 +1,4 @@
|
|||
"""Formulaires de gestion des données entrantes pour les gymnastes et accidents."""
|
||||
'''Formulaires de gestion des données entrantes pour les gymnastes et accidents.'''
|
||||
|
||||
from django import forms
|
||||
|
||||
|
@ -22,29 +22,29 @@ class GymnastForm(forms.ModelForm):
|
|||
)
|
||||
|
||||
widgets = {
|
||||
"last_name": forms.TextInput(
|
||||
attrs={"class": "form-control", "placeholder": "Lastname"}
|
||||
'last_name': forms.TextInput(
|
||||
attrs={'class': 'form-control', 'placeholder': 'Lastname'}
|
||||
),
|
||||
"first_name": forms.TextInput(
|
||||
attrs={"class": "form-control", "placeholder": "Firstname"}
|
||||
'first_name': forms.TextInput(
|
||||
attrs={'class': 'form-control', 'placeholder': 'Firstname'}
|
||||
),
|
||||
"birthdate": forms.DateInput(attrs={"class": "form-control datepicker"}),
|
||||
"gender": forms.Select(attrs={"class": "form-control"}),
|
||||
"club": forms.HiddenInput(),
|
||||
"trainings_by_week": forms.TextInput(
|
||||
attrs={"class": "form-control", "placeholder": "5"}
|
||||
'birthdate': forms.DateInput(attrs={'class': 'form-control datepicker'}),
|
||||
'gender': forms.Select(attrs={'class': 'form-control'}),
|
||||
'club': forms.HiddenInput(),
|
||||
'trainings_by_week': forms.TextInput(
|
||||
attrs={'class': 'form-control', 'placeholder': '5'}
|
||||
),
|
||||
"hours_by_week": forms.TextInput(
|
||||
attrs={"class": "form-control", "placeholder": "11,5"}
|
||||
'hours_by_week': forms.TextInput(
|
||||
attrs={'class': 'form-control', 'placeholder': '11,5'}
|
||||
),
|
||||
}
|
||||
|
||||
club_related = forms.CharField(
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Searching club…",
|
||||
"data-ref": "#id_club",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching club…',
|
||||
'data-ref': '#id_club',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
|
|
@ -5,49 +5,49 @@ from . import views
|
|||
gymnast_urlpatterns = [
|
||||
path(r"", views.gymnast_listing, name="gymnast_list"),
|
||||
path(r"lookup/", views.gymnast_lookup),
|
||||
path(r"details/<int:gymnastid>/", views.gymnast_details, name="gymnast_details"),
|
||||
path(r"details/<int:gymnast_id>/", views.gymnast_details, name="gymnast_details"),
|
||||
path(
|
||||
r"<int:gymnastid>/statistics/",
|
||||
r"<int:gymnast_id>/statistics/",
|
||||
views.gymnast_display_skill,
|
||||
name="gymnast_display_skill",
|
||||
),
|
||||
path(
|
||||
r"<int:gymnastid>/routine/",
|
||||
r"<int:gymnast_id>/routine/",
|
||||
views.gymnast_display_routines,
|
||||
name="gymnast_display_routine",
|
||||
),
|
||||
path(
|
||||
r"<int:gymnastid>/to-routine/",
|
||||
r"<int:gymnast_id>/to-routine/",
|
||||
views.link_routine_to_gymnast,
|
||||
name="link_routine_to_gymnast",
|
||||
),
|
||||
path(
|
||||
r"<int:gymnastid>/event/",
|
||||
r"<int:gymnast_id>/event/",
|
||||
views.gymnast_display_event,
|
||||
name="gymnast_display_event",
|
||||
),
|
||||
path(
|
||||
r"<int:gymnastid>/accident/",
|
||||
r"<int:gymnast_id>/accident/",
|
||||
views.gymnast_display_accident,
|
||||
name="gymnast_display_accident",
|
||||
),
|
||||
path(
|
||||
r"<int:gymnastid>/scores_chrono/",
|
||||
r"<int:gymnast_id>/scores_chrono/",
|
||||
views.gymnast_display_scores_chrono,
|
||||
name="gymnast_display_scores_chrono",
|
||||
),
|
||||
path(
|
||||
r"<int:gymnastid>/mindstate/",
|
||||
r"<int:gymnast_id>/mindstate/",
|
||||
views.gymnast_display_mindstate,
|
||||
name="gymnast_display_mindstate",
|
||||
),
|
||||
path(
|
||||
r"<int:gymnastid>/physiological/",
|
||||
r"<int:gymnast_id>/physiological/",
|
||||
views.gymnast_display_phisiological,
|
||||
name="gymnast_display_phisiological",
|
||||
),
|
||||
path(r"add/", views.gymnast_create_or_update, name="gymnast_create"),
|
||||
path(
|
||||
r"edit/<int:gymnastid>/", views.gymnast_create_or_update, name="gymnast_update"
|
||||
r"edit/<int:gymnast_id>/", views.gymnast_create_or_update, name="gymnast_update"
|
||||
),
|
||||
]
|
|
@ -3,13 +3,13 @@ from django.http import HttpResponse
|
|||
from django.contrib.auth.decorators import login_required
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.db.models import Q, Count, Min
|
||||
from django.db.models import Q, F, Count, Min
|
||||
from django.contrib import messages
|
||||
|
||||
from .models import Gymnast
|
||||
from .forms import GymnastForm
|
||||
from ultron.followup.models import Event
|
||||
from ultron.objective.models import Educative
|
||||
from ultron.objective.models import Educative, Plan
|
||||
from ultron.followup.forms import GymnastHasRoutineForm
|
||||
from ultron.followup.models import Chrono, LearnedSkill, MindState, Skill, Point, Accident, HeightWeight
|
||||
|
||||
|
@ -52,12 +52,12 @@ def gymnast_listing(request):
|
|||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def gymnast_details(request, gymnastid):
|
||||
def gymnast_details(request, gymnast_id):
|
||||
"""
|
||||
Récupère toutes les informations d'un gymnaste.
|
||||
"""
|
||||
|
||||
gymnast = get_object_or_404(Gymnast, pk=gymnastid)
|
||||
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
|
||||
|
||||
context = {} # devrait disparaitre
|
||||
context = gymnast.get_informations_from_level() # devrait disparaitre
|
||||
|
@ -65,33 +65,35 @@ def gymnast_details(request, gymnastid):
|
|||
gymnast_nb_known_skills = gymnast.known_skills.distinct('skill').count() # devrait disparaitre
|
||||
context["gymnast_nb_known_skills"] = gymnast_nb_known_skills # devrait disparaitre
|
||||
|
||||
learnedskills_list = LearnedSkill.objects.filter(gymnast=gymnastid).order_by('-date')[:10]
|
||||
nb_skill = Skill.objects.all().count()
|
||||
nb_known_skill = LearnedSkill.objects.filter(gymnast=gymnastid).distinct('skill').count()
|
||||
percentage_known_skill = ( nb_known_skill / nb_skill ) * 100
|
||||
chronos_list = Chrono.objects.filter(gymnast=gymnastid).order_by('-date')[:10]
|
||||
straightjump_score = Chrono.objects.filter(gymnast=gymnastid).filter(type=0).order_by('-date')
|
||||
best_straightjump = Chrono.objects.filter(gymnast=gymnastid).filter(type=0).order_by('-score')[:1]
|
||||
best_routine = Chrono.objects.filter(gymnast=gymnastid).filter(type=1).order_by('-score')[:1]
|
||||
routine_score = Chrono.objects.filter(gymnast=gymnastid).filter(type=1).order_by('-date')
|
||||
planified_learn = Plan.objects.filter(gymnast=gymnast_id).order_by('-date') # devrait disparaitre ?
|
||||
context["planified_learn"] = planified_learn
|
||||
|
||||
points_routine_1_list = Point.objects.filter(gymnast=gymnastid).filter(routine_type=0).order_by('-event__datebegin')
|
||||
points_routine_2_list = Point.objects.filter(gymnast=gymnastid).filter(routine_type=1).order_by('-event__datebegin')
|
||||
points_routine_final_list = Point.objects.filter(gymnast=gymnastid).filter(routine_type=2).order_by('-event__datebegin')
|
||||
learnedskills_list = LearnedSkill.objects.filter(gymnast=gymnast_id).order_by('-date')[:10]
|
||||
nb_skill = Skill.objects.all().count()
|
||||
nb_known_skill = LearnedSkill.objects.filter(gymnast=gymnast_id).distinct('skill').count()
|
||||
percentage_known_skill = ( nb_known_skill / nb_skill ) * 100
|
||||
chronos_list = Chrono.objects.filter(gymnast=gymnast_id).order_by('-date')[:10]
|
||||
straightjump_score = Chrono.objects.filter(gymnast=gymnast_id).filter(type=0).order_by('-date')
|
||||
best_straightjump = Chrono.objects.filter(gymnast=gymnast_id).filter(type=0).order_by('-score')[:1]
|
||||
best_routine = Chrono.objects.filter(gymnast=gymnast_id).filter(type=1).order_by('-score')[:1]
|
||||
routine_score = Chrono.objects.filter(gymnast=gymnast_id).filter(type=1).order_by('-date')
|
||||
|
||||
points_routine_1_list = Point.objects.filter(gymnast=gymnast_id).filter(routine_type=0).order_by('-event__datebegin')
|
||||
points_routine_2_list = Point.objects.filter(gymnast=gymnast_id).filter(routine_type=1).order_by('-event__datebegin')
|
||||
points_routine_final_list = Point.objects.filter(gymnast=gymnast_id).filter(routine_type=2).order_by('-event__datebegin')
|
||||
|
||||
# Devrait être dans un template tags
|
||||
nb_skill_chained = Skill.objects.filter(known_by__gymnast=gymnastid, known_by__cando=3).distinct().count()
|
||||
nb_skill_chained = Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__cando=3).distinct().count()
|
||||
|
||||
nb_skill_not_chained = Skill.objects.filter(known_by__gymnast=gymnastid, known_by__cando=2).exclude(
|
||||
nb_skill_not_chained = Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__cando=2).exclude(
|
||||
known_by__gymnast=gymnast.id, known_by__cando=3
|
||||
).distinct().count()
|
||||
|
||||
nb_skill_whith_help = Skill.objects.filter(known_by__gymnast=gymnastid, known_by__cando=1).exclude(
|
||||
nb_skill_whith_help = Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__cando=1).exclude(
|
||||
known_by__gymnast=gymnast.id, known_by__cando__gte=2
|
||||
).distinct().count()
|
||||
|
||||
height_weight = HeightWeight.objects.filter(gymnast=gymnastid).order_by('-date')[:1]
|
||||
# print(height_weight)
|
||||
height_weight = HeightWeight.objects.filter(gymnast=gymnast_id).order_by('-date')[:1]
|
||||
|
||||
nb_unknown_skill = nb_skill - gymnast_nb_known_skills
|
||||
|
||||
|
@ -135,13 +137,13 @@ def gymnast_details(request, gymnastid):
|
|||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def gymnast_display_event(request, gymnastid):
|
||||
def gymnast_display_event(request, gymnast_id):
|
||||
"""
|
||||
Renvoie deux listes d'évènements : ceux à venir et ceux passés.
|
||||
"""
|
||||
today = pendulum.now().date()
|
||||
next_event_list = Event.objects.filter(gymnasts=gymnastid, datebegin__gte=today)
|
||||
previous_event_list = Event.objects.filter(gymnasts=gymnastid, datebegin__lte=today)
|
||||
next_event_list = Event.objects.filter(gymnasts=gymnast_id, datebegin__gte=today)
|
||||
previous_event_list = Event.objects.filter(gymnasts=gymnast_id, datebegin__lte=today)
|
||||
|
||||
context = {
|
||||
"next_event_list": next_event_list,
|
||||
|
@ -152,15 +154,15 @@ def gymnast_display_event(request, gymnastid):
|
|||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def gymnast_display_accident(request, gymnastid):
|
||||
def gymnast_display_accident(request, gymnast_id):
|
||||
"""
|
||||
Renvoie deux listes d'évènements : ceux à venir et ceux passés.
|
||||
"""
|
||||
accident_list = Accident.objects.filter(gymnast=gymnastid)
|
||||
accident_list = Accident.objects.filter(gymnast=gymnast_id)
|
||||
|
||||
context = {
|
||||
"accident_list": accident_list,
|
||||
"gymnastid": gymnastid
|
||||
"gymnast_id": gymnast_id
|
||||
}
|
||||
|
||||
return render(request, "peoples/gymnasts/list_accident.html", context)
|
||||
|
@ -168,19 +170,19 @@ def gymnast_display_accident(request, gymnastid):
|
|||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def gymnast_display_phisiological(request, gymnastid):
|
||||
def gymnast_display_phisiological(request, gymnast_id):
|
||||
"""
|
||||
Renvoie les listes des tailles/poids, état d'esprit et accidents.
|
||||
"""
|
||||
accident_list = Accident.objects.filter(gymnast=gymnastid).order_by('-date')
|
||||
mindstate_list = MindState.objects.filter(gymnast=gymnastid).order_by('-date')
|
||||
height_weight_list = HeightWeight.objects.filter(gymnast=gymnastid).order_by('-date')
|
||||
accident_list = Accident.objects.filter(gymnast=gymnast_id).order_by('-date')
|
||||
mindstate_list = MindState.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,
|
||||
'mindstate_list': mindstate_list,
|
||||
'height_weight_list': height_weight_list,
|
||||
'gymnastid': gymnastid,
|
||||
'gymnast_id': gymnast_id,
|
||||
|
||||
}
|
||||
|
||||
|
@ -189,16 +191,16 @@ def gymnast_display_phisiological(request, gymnastid):
|
|||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def gymnast_display_scores_chrono(request, gymnastid):
|
||||
def gymnast_display_scores_chrono(request, gymnast_id):
|
||||
"""
|
||||
Selectionne tous les scores réalisés par le gymnaste
|
||||
"""
|
||||
score_list = Point.objects.filter(gymnast=gymnastid).order_by("-event__datebegin")
|
||||
score_list = Point.objects.filter(gymnast=gymnast_id).order_by("-event__datebegin")
|
||||
score_routine1_list = score_list.filter(routine_type=0)
|
||||
score_routine2_list = score_list.filter(routine_type=1)
|
||||
score_routine3_list = score_list.filter(routine_type=2)
|
||||
|
||||
chrono_list = Chrono.objects.filter(gymnast=gymnastid).order_by("date")
|
||||
chrono_list = Chrono.objects.filter(gymnast=gymnast_id).order_by("date")
|
||||
chrono_10c = chrono_list.filter(type=0)
|
||||
chrono_r1 = chrono_list.filter(type=1)
|
||||
chrono_r2 = chrono_list.filter(type=2)
|
||||
|
@ -214,7 +216,7 @@ def gymnast_display_scores_chrono(request, gymnastid):
|
|||
"chrono_r1": chrono_r1,
|
||||
"chrono_r2": chrono_r2,
|
||||
"chrono_rf": chrono_rf,
|
||||
"gymnastid": gymnastid,
|
||||
"gymnast_id": gymnast_id,
|
||||
}
|
||||
|
||||
return render(request, "peoples/gymnasts/list_scores_chronos.html", context)
|
||||
|
@ -222,15 +224,15 @@ def gymnast_display_scores_chrono(request, gymnastid):
|
|||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def gymnast_display_mindstate(request, gymnastid):
|
||||
def gymnast_display_mindstate(request, gymnast_id):
|
||||
"""
|
||||
Selectionne tous les scores réalisés par le gymnaste
|
||||
"""
|
||||
mindstate_list = MindState.objects.filter(gymnast=gymnastid).order_by("-date")
|
||||
mindstate_list = MindState.objects.filter(gymnast=gymnast_id).order_by("-date")
|
||||
|
||||
context = {
|
||||
"mindstate_list": mindstate_list,
|
||||
"gymnastid": gymnastid,
|
||||
"gymnast_id": gymnast_id,
|
||||
}
|
||||
|
||||
return render(request, "peoples/gymnasts/list_mindstate.html", context)
|
||||
|
@ -238,25 +240,25 @@ def gymnast_display_mindstate(request, gymnastid):
|
|||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def gymnast_display_routines(request, gymnastid):
|
||||
def gymnast_display_routines(request, gymnast_id):
|
||||
"""
|
||||
Tag affichant les séries d'un gymnaste.
|
||||
"""
|
||||
gymnast = get_object_or_404(Gymnast, pk=gymnastid)
|
||||
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
|
||||
ghr_list = gymnast.has_routine.prefetch_related("routine")
|
||||
context = {"ghr_list": ghr_list, "gymnastid": gymnastid}
|
||||
context = {"ghr_list": ghr_list, "gymnast_id": gymnast_id}
|
||||
return render(request, "peoples/gymnasts/list_routine.html", context)
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["GET", "POST"])
|
||||
def link_routine_to_gymnast(request, gymnastid=None):
|
||||
def link_routine_to_gymnast(request, gymnast_id=None):
|
||||
"""
|
||||
"""
|
||||
|
||||
if gymnastid:
|
||||
gymnast = get_object_or_404(Gymnast, pk=gymnastid)
|
||||
data = {"gymnast": gymnast.id, "gymnast_related": str(gymnast), "dateend": None}
|
||||
if gymnast_id:
|
||||
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
|
||||
data = {"gymnast": gymnast_id, "gymnast_related": str(gymnast), "dateend": None}
|
||||
else:
|
||||
gymnast = None
|
||||
data = {"dateend": None}
|
||||
|
@ -266,27 +268,27 @@ def link_routine_to_gymnast(request, gymnastid=None):
|
|||
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
if gymnastid is not None:
|
||||
return HttpResponseRedirect("/gymnast/details/" + str(gymnastid) + "/")
|
||||
if gymnast_id is not None:
|
||||
return HttpResponseRedirect("/gymnast/details/" + str(gymnast_id) + "/")
|
||||
else:
|
||||
return HttpResponseRedirect("/gymnast/")
|
||||
|
||||
else:
|
||||
form = GymnastHasRoutineForm(instance=gymnast, initial=data)
|
||||
|
||||
context = {"form": form, "gymnastid": gymnastid}
|
||||
context = {"form": form, "gymnast_id": gymnast_id}
|
||||
return render(request, "peoples/gymnasts/link_to_routine.html", context)
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["GET", "POST"])
|
||||
def gymnast_create_or_update(request, gymnastid=None):
|
||||
def gymnast_create_or_update(request, gymnast_id=None):
|
||||
"""
|
||||
Formulaire de creation et modification d'un gymnaste.
|
||||
"""
|
||||
|
||||
if gymnastid:
|
||||
gymnast = get_object_or_404(Gymnast, pk=gymnastid)
|
||||
if gymnast_id:
|
||||
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
|
||||
data = {'club_related': gymnast.club}
|
||||
else:
|
||||
gymnast = None
|
||||
|
@ -303,13 +305,13 @@ def gymnast_create_or_update(request, gymnastid=None):
|
|||
|
||||
form = GymnastForm(instance=gymnast, initial=data)
|
||||
|
||||
context = {"form": form, "gymnastid": gymnastid}
|
||||
context = {"form": form, "gymnast_id": gymnast_id}
|
||||
return render(request, "peoples/gymnasts/create.html", context)
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
def gymnast_display_skill(request, gymnastid):
|
||||
def gymnast_display_skill(request, gymnast_id):
|
||||
"""
|
||||
Tag affichant les statistiques de skill d'un gymnaste : le nombre de saut qu'il sait faire (total,
|
||||
par niveau, par rank, …), calcule la complétude, …
|
||||
|
@ -320,11 +322,15 @@ def gymnast_display_skill(request, gymnastid):
|
|||
"""
|
||||
|
||||
context = {}
|
||||
gymnast = get_object_or_404(Gymnast, pk=gymnastid)
|
||||
gymnast = get_object_or_404(Gymnast, pk=gymnast_id)
|
||||
gymnast_nb_known_skills = gymnast.known_skills.distinct('skill').count()
|
||||
context = gymnast.get_informations_from_level()
|
||||
context.update(gymnast.get_informations_from_rank())
|
||||
|
||||
planified_skill = Skill.objects.filter(plan__gymnast=gymnast.id).order_by('-plan__date').annotate(plan_date=F("plan__date"))
|
||||
|
||||
context["planified_skill"] = planified_skill
|
||||
|
||||
if gymnast.gender:
|
||||
context["skill_by_age"] = Skill.objects.filter(age_girl__lte=gymnast.age).exclude(
|
||||
known_by__gymnast=gymnast.id
|
||||
|
@ -334,11 +340,11 @@ def gymnast_display_skill(request, gymnastid):
|
|||
known_by__gymnast=gymnast.id
|
||||
)
|
||||
|
||||
skill_whith_help = Skill.objects.filter(known_by__gymnast=gymnastid, known_by__cando=1).exclude(
|
||||
skill_whith_help = Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__cando=1).exclude(
|
||||
known_by__gymnast=gymnast.id, known_by__cando__gte=2
|
||||
).distinct()
|
||||
|
||||
skill_not_chained = Skill.objects.filter(known_by__gymnast=gymnastid, known_by__cando=2).exclude(
|
||||
skill_not_chained = Skill.objects.filter(known_by__gymnast=gymnast_id, known_by__cando=2).exclude(
|
||||
known_by__gymnast=gymnast.id, known_by__cando=3
|
||||
).distinct()
|
||||
|
||||
|
|
|
@ -9,42 +9,42 @@ from .models import Event
|
|||
|
||||
class EventForm(forms.ModelForm):
|
||||
|
||||
# gymnasts = forms.ModelMultipleChoiceField(queryset=Gymnast.objects.all(), widget=FilteredSelectMultiple("Gymnast(s)", is_stacked=False))
|
||||
# gymnasts = forms.ModelMultipleChoiceField(queryset=Gymnast.objects.all(), widget=FilteredSelectMultiple('Gymnast(s)', is_stacked=False))
|
||||
|
||||
class Meta:
|
||||
model = Event
|
||||
fields = (
|
||||
"name",
|
||||
"datebegin",
|
||||
"dateend",
|
||||
"place",
|
||||
"eventtype",
|
||||
"informations",
|
||||
'name',
|
||||
'datebegin',
|
||||
'dateend',
|
||||
'place',
|
||||
'eventtype',
|
||||
'informations',
|
||||
) # , 'gymnasts'
|
||||
widgets = {
|
||||
"place": forms.HiddenInput(),
|
||||
# 'gymnasts': forms.ModelMultipleChoiceField(queryset=Gymnast.objects.all(), widget=FilteredSelectMultiple("Gymnast(s)", is_stacked=False)),
|
||||
'place': forms.HiddenInput(),
|
||||
# 'gymnasts': forms.ModelMultipleChoiceField(queryset=Gymnast.objects.all(), widget=FilteredSelectMultiple('Gymnast(s)', is_stacked=False)),
|
||||
# 'gymnasts': forms.MultipleChoiceField(choices=MYCHOICES, widget=forms.SelectMultiple)
|
||||
"eventtype": forms.Select(attrs={"class": "form-control"}),
|
||||
"name": forms.TextInput(
|
||||
attrs={"class": "form-control", "placeholder": "Even's name"}
|
||||
'eventtype': forms.Select(attrs={'class': 'form-control'}),
|
||||
'name': forms.TextInput(
|
||||
attrs={'class': 'form-control', 'placeholder': 'Even\'s name'}
|
||||
),
|
||||
"datebegin": forms.DateTimeInput(
|
||||
'datebegin': forms.DateTimeInput(
|
||||
attrs={
|
||||
"class": "form-control datetimepicker",
|
||||
"placeholder": date.today().strftime("%Y-%m-%d 08:00"),
|
||||
'class': 'form-control datetimepicker',
|
||||
'placeholder': date.today().strftime('%Y-%m-%d 08:00'),
|
||||
}
|
||||
),
|
||||
"dateend": forms.DateTimeInput(
|
||||
'dateend': forms.DateTimeInput(
|
||||
attrs={
|
||||
"class": "form-control datetimepicker",
|
||||
"placeholder": date.today().strftime("%Y-%m-%d 18:00"),
|
||||
'class': 'form-control datetimepicker',
|
||||
'placeholder': date.today().strftime('%Y-%m-%d 18:00'),
|
||||
}
|
||||
),
|
||||
"informations": forms.Textarea(
|
||||
'informations': forms.Textarea(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Informations about the event…",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Informations about the event…',
|
||||
}
|
||||
),
|
||||
}
|
||||
|
@ -52,13 +52,13 @@ class EventForm(forms.ModelForm):
|
|||
place_related = forms.CharField(
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
"class": "form-control",
|
||||
"placeholder": "Searching place…",
|
||||
"data-ref": "#id_place",
|
||||
'class': 'form-control',
|
||||
'placeholder': 'Searching place…',
|
||||
'data-ref': '#id_place',
|
||||
}
|
||||
)
|
||||
)
|
||||
# Nécessaire pour le "ModelMultipleChoiceField" apparement
|
||||
# Nécessaire pour le 'ModelMultipleChoiceField' apparement
|
||||
# class Media:
|
||||
# css = {'all':('/static/admin/css/widgets.css',),}
|
||||
# js = ('/admin/jquery.js','/admin/jsi18n/') # OLD
|
||||
|
|
|
@ -9,18 +9,18 @@ class ProfileForm(forms.ModelForm):
|
|||
class Meta:
|
||||
model = Profile
|
||||
fields = (
|
||||
"template_color",
|
||||
"sidebar_color",
|
||||
"is_sidebar_minified",
|
||||
'template_color',
|
||||
'sidebar_color',
|
||||
'is_sidebar_minified',
|
||||
)
|
||||
widgets = {
|
||||
"template_color": forms.Select(attrs={"class": "form-control"}),
|
||||
"sidebar_color": forms.Select(attrs={"class": "form-control"}),
|
||||
"is_sidebar_minified": forms.CheckboxInput(
|
||||
'template_color': forms.Select(attrs={'class': 'form-control'}),
|
||||
'sidebar_color': forms.Select(attrs={'class': 'form-control'}),
|
||||
'is_sidebar_minified': forms.CheckboxInput(
|
||||
attrs={
|
||||
"class": "bootstrap-switch mt-0",
|
||||
"data-on-label": "<i class='tim-icons icon-check-2 text-success'></i>",
|
||||
"data-off-label": "<i class='tim-icons icon-simple-remove text-danger'></i>",
|
||||
'class': 'bootstrap-switch mt-0',
|
||||
'data-on-label': '<i class="tim-icons icon-check-2 text-success"></i>',
|
||||
'data-off-label': '<i class="tim-icons icon-simple-remove text-danger"></i>',
|
||||
}
|
||||
),
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ class TemporizableQuerySet(models.QuerySet):
|
|||
:type limit: int
|
||||
:return: une liste de `limit` éléments temporizables.
|
||||
"""
|
||||
return self.filter(datebegin__gte=timezone.now()).order_by("datebegin")[0:limit]
|
||||
return self.filter(datebegin__gte=timezone.now()).order_by('datebegin')[0:limit]
|
||||
|
||||
def last(self, limit):
|
||||
"""
|
||||
|
@ -69,7 +69,7 @@ class TemporizableQuerySet(models.QuerySet):
|
|||
:type limit: int
|
||||
:return: une liste de `limit` éléments temporizables
|
||||
"""
|
||||
return self.filter(dateend__lte=timezone.now()).order_by("-dateend")[0:limit]
|
||||
return self.filter(dateend__lte=timezone.now()).order_by('-dateend')[0:limit]
|
||||
|
||||
# def get(self, date_string):
|
||||
# """
|
||||
|
@ -92,8 +92,8 @@ class Temporizable(models.Model):
|
|||
class Meta:
|
||||
abstract = True
|
||||
|
||||
datebegin = models.DateTimeField(verbose_name="Début")
|
||||
dateend = models.DateTimeField(blank=True, verbose_name="Fin")
|
||||
datebegin = models.DateTimeField(verbose_name='Début')
|
||||
dateend = models.DateTimeField(blank=True, verbose_name='Fin')
|
||||
|
||||
objects = models.Manager.from_queryset(TemporizableQuerySet)()
|
||||
|
||||
|
@ -150,8 +150,8 @@ class Markdownizable(models.Model):
|
|||
informations = models.TextField(
|
||||
null=True,
|
||||
blank=True,
|
||||
verbose_name="Comments",
|
||||
help_text="Only MarkDown is authorized",
|
||||
verbose_name='Comments',
|
||||
help_text='Only MarkDown is authorized',
|
||||
)
|
||||
|
||||
def to_markdown(self):
|
||||
|
|
Loading…
Reference in New Issue