Minor improvement
This commit is contained in:
parent
0cb1a81215
commit
16486064ce
|
@ -31,7 +31,7 @@ class SkillAdmin(ForeignKeyAutocompleteAdmin):
|
|||
model = Skill
|
||||
|
||||
fields = (
|
||||
"label",
|
||||
"long_label",
|
||||
"short_label",
|
||||
"information",
|
||||
"departure",
|
||||
|
@ -53,7 +53,7 @@ class SkillAdmin(ForeignKeyAutocompleteAdmin):
|
|||
)
|
||||
|
||||
list_display = (
|
||||
"label",
|
||||
"long_label",
|
||||
"difficulty",
|
||||
"is_competitive",
|
||||
"level",
|
||||
|
@ -63,8 +63,8 @@ class SkillAdmin(ForeignKeyAutocompleteAdmin):
|
|||
"age_girl",
|
||||
)
|
||||
|
||||
ordering = ("label", "short_label")
|
||||
search_fields = ("rank", "label", "short_label")
|
||||
ordering = ("long_label", "short_label")
|
||||
search_fields = ("rank", "long_label", "short_label")
|
||||
list_filter = (
|
||||
"is_competitive",
|
||||
"departure",
|
||||
|
@ -90,7 +90,7 @@ class RoutineAdmin(admin.ModelAdmin):
|
|||
model = Routine
|
||||
|
||||
fields = (
|
||||
"label",
|
||||
"long_label",
|
||||
"short_label",
|
||||
"difficulty",
|
||||
"level",
|
||||
|
@ -103,7 +103,7 @@ class RoutineAdmin(admin.ModelAdmin):
|
|||
"is_competitive",
|
||||
)
|
||||
list_display = (
|
||||
"label",
|
||||
"long_label",
|
||||
"short_label",
|
||||
"is_competitive",
|
||||
"active",
|
||||
|
@ -113,7 +113,7 @@ class RoutineAdmin(admin.ModelAdmin):
|
|||
)
|
||||
list_filter = ("level", "difficulty", "is_competitive", "active")
|
||||
search_fields = (
|
||||
"label",
|
||||
"long_label",
|
||||
"short_label",
|
||||
)
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@ from .models import Routine, RoutineSkill, Chrono
|
|||
class RoutineForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Routine
|
||||
fields = ("label", "label", "difficulty", "level", "active")
|
||||
fields = ("long_label", "short_label", "difficulty", "level", "active")
|
||||
widgets = {
|
||||
# Champs obligatoires de la classe mère.
|
||||
"label": forms.TextInput(
|
||||
"long_label": forms.TextInput(
|
||||
attrs={"class": "form-control", "placeholder": "Routine's long name"}
|
||||
),
|
||||
"label": forms.TextInput(
|
||||
"short_label": forms.TextInput(
|
||||
attrs={"class": "form-control", "placeholder": "Routine's short name"}
|
||||
),
|
||||
"difficulty": forms.HiddenInput(),
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# Generated by Django 3.2.8 on 2021-12-05 11:33
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('objective', '0017_auto_20210620_1618'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='educative',
|
||||
options={'ordering': ['long_label', 'short_label'], 'verbose_name': 'Educatif', 'verbose_name_plural': 'Educatifs'},
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='educative',
|
||||
old_name='label',
|
||||
new_name='long_label',
|
||||
),
|
||||
]
|
|
@ -18,9 +18,9 @@ class Educative(Markdownizable):
|
|||
class Meta:
|
||||
verbose_name = "Educatif"
|
||||
verbose_name_plural = "Educatifs"
|
||||
ordering = ["label", "short_label"] # 'level',
|
||||
ordering = ["long_label", "short_label"] # 'level',
|
||||
|
||||
label = models.CharField(max_length=255, verbose_name="Long Name")
|
||||
long_label = models.CharField(max_length=255, verbose_name="Long Name")
|
||||
short_label = models.CharField(max_length=255, verbose_name="Short Name")
|
||||
difficulty = models.DecimalField(
|
||||
max_digits=3, decimal_places=1, verbose_name="Difficulty"
|
||||
|
@ -154,7 +154,7 @@ class Routine(Educative):
|
|||
is_competitive = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return "%s (%s)" % (self.label, self.short_label)
|
||||
return "%s (%s)" % (self.long_label, self.short_label)
|
||||
|
||||
def contains_basic_jumps(self):
|
||||
"""
|
||||
|
|
|
@ -7,7 +7,7 @@ from . import views
|
|||
# Skills
|
||||
skill_urlpatterns = [
|
||||
re_path(
|
||||
r"^(?P<field>(level|rank|difficulty|landing|rotation|departure|twist))/(?P<expression>[\w]+)/(?P<value>[\w]+)$",
|
||||
r"^(?P<field>(level|rank|difficulty))/(?P<expression>[\w]+)/(?P<value>[\w]+)$",
|
||||
views.skill_listing,
|
||||
name="skill_listing_by_key",
|
||||
),
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 3.2.8 on 2021-12-05 11:33
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('planning', '0021_auto_20210513_1058'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='event_participation',
|
||||
options={'verbose_name': 'Event Participation'},
|
||||
),
|
||||
]
|
|
@ -1,5 +1,7 @@
|
|||
-r base.txt
|
||||
|
||||
sqlparse==0.4.1
|
||||
mysqlclient==2.0.3
|
||||
black==19.10b0
|
||||
coverage==5.5
|
||||
flake8==3.9.1
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
-r dev.txt
|
||||
|
||||
mysqlclient==2.0.3
|
||||
sqlparse==0.4.1
|
|
@ -1,117 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% 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="card-title">{% if accidentid %}Edit{% else %}Add{% endif %} accident</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{% if accidentid %}{% url 'accident_update' accidentid %}{% else %}{% url 'accident_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-2 col-md-2 col-lg-2 col-xl-2 col-form-label">Date</label>
|
||||
<div class="col-8 col-sm-6 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_gymnast" class="col-4 col-sm-2 col-md-2 col-lg-2 col-xl-2 col-form-label">Gymnast</label>
|
||||
<div class="col-8 col-sm-8 col-md-6 col-lg-6 col-xl-6 {% if form.gymnast.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_skill" class="col-4 col-sm-2 col-md-2 col-lg-2 col-xl-2 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 row ">
|
||||
<label for="id_information" class="col-4 col-sm-2 col-md-2 col-lg-2 col-xl-2 col-form-label">Informations</label>
|
||||
<div class="col-8 col-sm-9 col-md-9 col-lg-9 col-xl-9 {% if form.id_information.errors %}has-danger{% endif %}">
|
||||
{{ form.content }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" value="{% if accidentid %}Save{% else %}Add{% endif %}" class="btn btn-warning" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" >
|
||||
$(function(){
|
||||
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.label,
|
||||
value: item.label,
|
||||
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 %}
|
|
@ -1,36 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
<!-- {% block page_title %}.: Accident's details :.{% endblock %} -->
|
||||
|
||||
<!-- {% block title %}Accident{% endblock %} -->
|
||||
|
||||
{% 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="card-title mb-0">Accident : {{ accident.date | date:"d-m-Y" }}</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<a href="{% url 'gymnast_details' accident.gymnast.id %}">{{ accident.gymnast }}</a>
|
||||
<br />
|
||||
<a href="{% url 'skill_details' accident.educative.id %}">{{ accident.educative }}</a>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
{{ accident.to_markdown | safe }}
|
||||
|
||||
<div class="card-footer pl-0 pb-0">
|
||||
<a href="{% url 'accident_list' %}">
|
||||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||||
<i class="tim-icons icon-double-left"></i>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -1,75 +0,0 @@
|
|||
{% extends "listing.html" %}
|
||||
|
||||
<!-- {% block page_title %}.: Accident's list :.{% endblock %}
|
||||
{% block searchurl %}accident{% endblock %}
|
||||
{% block title %}Accidents{% endblock %}
|
||||
{% block addurl %}accident{% endblock %}
|
||||
{% block modurl %}accident{% endblock %}
|
||||
{% block search %}accident{% endblock %} -->
|
||||
|
||||
{% block datacontent %}
|
||||
<div class="card mb-0">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title"> Accidents' Listing</h4>
|
||||
</div>
|
||||
<div class="card-body pb-0">
|
||||
<div class="table-responsive pb-0">
|
||||
{% if accident_list.count >= 1 %}
|
||||
<table class="table tablesorter table-striped table-condensed" data-sort="table" id="maintable">
|
||||
<thead class="text-primary">
|
||||
<tr>
|
||||
<th style="width: 3%"></th>
|
||||
<th style="width: 10%">Date</th>
|
||||
<th style="width: 45%">Gymnast</th>
|
||||
<th style="width: 42%">Skill</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for accident in accident_list %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url 'accident_update' accident.id %}">
|
||||
<button type="button" rel="tooltip" class="btn btn-link btn-sm btn-icon">
|
||||
<span class="tim-icons icon-pencil text-warning"></span>
|
||||
</button>
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-right"><a href="{% url 'accident_details' accident.id %}">{{ accident.date | date:"d-m-Y" }}</a></td>
|
||||
<td class="text-left"><a href="{% url 'gymnast_details' accident.gymnast.id %}">{{ accident.gymnast }}</a></td>
|
||||
<td class="text-left"><a href="{% url 'skill_details' accident.educative.id %}">{{ accident.educative.notation }} ({{ accident.educative.shortLabel }})</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td>There are no accident corresponding to your criterias</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer text-right text-muted pt-0">
|
||||
<a href="{% url 'accident_create' %}">
|
||||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||||
<i class="tim-icons icon-simple-add"></i>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footerscript %}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('[data-sort="table"]').tablesorter({
|
||||
headers: {
|
||||
0: { sorter: false }, // disable first column
|
||||
},
|
||||
dateFormat: "uk",
|
||||
sortList: [[1,1]]
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -1,200 +0,0 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-sm-12 col-md-8 col-lg-6 col-xl-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title">{% if scoreid %}Edit{% else %}Add{% endif %} score</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{% if scoreid %}{% url 'score_update' scoreid %}{% else %}{% url 'score_create' %}{% endif %}" method="post" class="form-horizontal" id="formulaire" name="formulaire">
|
||||
{% csrf_token %}
|
||||
<div class="form-group row ">
|
||||
<label for="id_gymnast" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-2 col-form-label">Gymnast</label>
|
||||
<div class="col-8 col-sm-9 col-md-9 col-lg-9 col-xl-10 {% if form.date.errors %}has-danger{% endif %}">
|
||||
{{ form.gymnast }}
|
||||
{{ form.gymnast_related }}
|
||||
{% if form.gymnast.errors %}
|
||||
<label class="text-danger" for="id_gymnast" id="gymnast-error">
|
||||
{% for error in form.gymnast.errors %}{{ error }}{% endfor %}
|
||||
</label>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_event" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-2 col-form-label">Event</label>
|
||||
<div class="col-8 col-sm-9 col-md-9 col-lg-9 col-xl-10 {% if form.date.errors %}has-danger{% endif %}">
|
||||
{{ form.event }}
|
||||
{{ form.event_related }}
|
||||
{% if form.event.errors %}
|
||||
<label class="btn btn-sm btn-danger-outline">
|
||||
{% for error in form.event.errors %}{{ error }}{% endfor %}
|
||||
</label>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_routine_type" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-2 col-form-label">Routine's type</label>
|
||||
<div class="col-sm-6 col-md-5 {% if form.date.errors %}has-danger{% endif %}">
|
||||
{{ form.routine_type }}
|
||||
{% if form.routine_type.errors %}
|
||||
<label class="btn btn-sm btn-danger-outline">
|
||||
{% for error in form.routine_type.errors %}{{error}}{% endfor %}
|
||||
</label>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row ">
|
||||
<label for="id_point_difficulty" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-2 col-form-label">Difficulty</label>
|
||||
<div class="col-sm-6 col-md-3 {% if form.date.errors %}has-danger{% endif %}">
|
||||
{{ form.point_difficulty }}
|
||||
{% if form.point_difficulty.errors %}
|
||||
<label class="text-danger" for="id_point_difficulty" id="point_difficulty-error">
|
||||
{% for error in form.point_difficulty.errors %}{{ error }}{% endfor %}
|
||||
</label>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="point_time_of_flight" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-2 col-form-label">ToF</label>
|
||||
<div class="col-sm-6 col-md-3 {% if form.date.errors %}has-danger{% endif %}">
|
||||
{{ form.point_time_of_flight }}
|
||||
{% if form.point_time_of_flight.errors %}
|
||||
<label class="text-danger" for="id_gymnast" id="gymnast-error">
|
||||
{% for error in form.point_time_of_flight.errors %}{{ error }}{% endfor %}
|
||||
</label>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_point_execution" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-2 col-form-label">Execution</label>
|
||||
<div class="col-sm-6 col-md-3 {% if form.date.errors %}has-danger{% endif %}">
|
||||
{{ form.point_execution }}
|
||||
{% if form.point_execution.errors %}
|
||||
<label class="text-danger" for="id_point_execution" id="point_execution-error">
|
||||
{% for error in form.point_execution.errors %}{{error}}{% endfor %}
|
||||
</label>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row ">
|
||||
<label for="point_horizontal_displacement" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-2 col-form-label">HD</label>
|
||||
<div class="col-sm-6 col-md-3 {% if form.date.errors %}has-danger{% endif %}">
|
||||
{{ form.point_horizontal_displacement }}
|
||||
{% if form.point_horizontal_displacement.errors %}
|
||||
<label class="text-danger" for="id_gymnast" id="gymnast-error">
|
||||
{% for error in form.point_horizontal_displacement.errors %}{{ error }}{% endfor %}
|
||||
</label>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="penality" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-2 col-form-label">Penality</label>
|
||||
<div class="col-sm-6 col-md-3 {% if form.date.errors %}has-danger{% endif %}">
|
||||
{{ form.penality }}
|
||||
{% if form.penality.errors %}
|
||||
<label class="text-danger" for="id_gymnast" id="gymnast-error">
|
||||
{% for error in form.penality.errors %}{{ error }}{% endfor %}
|
||||
</label>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_total" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-2 col-form-label">Total</label>
|
||||
<div class="col-sm-6 col-md-3 {% if form.date.errors %}has-danger{% endif %}">
|
||||
{{ form.total }}
|
||||
{% if form.total.errors %}
|
||||
<label class="text-danger" for="id_total" id="gymnast-error">
|
||||
{% for error in form.total.errors %}{{ error }}{% endfor %}
|
||||
</label>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" value="{% if scoreid %}Save{% else %}Add{% endif %}" class="btn btn-warning" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footerscript %}
|
||||
<script type="text/javascript" >
|
||||
$(function(){
|
||||
$('#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_event_related').autocomplete({
|
||||
source: function(request, response) {
|
||||
$.ajax({
|
||||
url: '/event/lookup/?pattern=' + $('#id_event_related').val(),
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.length != 0) {
|
||||
response($.map(data, function(item) {
|
||||
return {
|
||||
label: item.Name,
|
||||
value: item.Name,
|
||||
eventid: 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.eventid);
|
||||
}
|
||||
});
|
||||
|
||||
$('#id_point_execution, #id_point_difficulty, #id_point_time_of_flight, #id_point_horizontal_displacement, #id_penality').keyup(function(){
|
||||
var value = parseFloat($('#id_point_execution').val())
|
||||
+ parseFloat($('#id_point_difficulty').val())
|
||||
+ parseFloat($('#id_point_time_of_flight').val())
|
||||
+ parseFloat($('#id_point_horizontal_displacement').val())
|
||||
- parseFloat($('#id_penality').val());
|
||||
$('#id_total').val(value.toFixed(3));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -1,79 +0,0 @@
|
|||
{% extends "listing.html" %}
|
||||
|
||||
{% load format %}
|
||||
|
||||
{% block datacontent %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title">Scores' list</h4>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if score_list.count >= 1 %}
|
||||
<table class="table tablesorter table-striped mb-0" data-sort="table" id="maintable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class="header text-left">Gymnast</th>
|
||||
<th class="header text-left">Event</th>
|
||||
<th class="header text-left">Routine</th>
|
||||
<th class="header text-center">Exe.</th>
|
||||
<th class="header text-center">Dif.</th>
|
||||
<th class="header text-center">ToF</th>
|
||||
<th class="header text-center">HD</th>
|
||||
<th class="header text-center">Pen.</th>
|
||||
<th class="header text-center">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for score in score_list %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{% url 'score_update' score.id %}">
|
||||
<span class="tim-icons icon-pencil text-warning"></span>
|
||||
</a>
|
||||
</td>
|
||||
<td><a href="{% url 'gymnast_details' score.gymnast.id %}">{{ score.gymnast }}</a></td>
|
||||
<td><a href="{% url 'event_details' score.event.id %}">{{ score.event.name }}</a></td>
|
||||
<td>{{ score.get_routine_type_display }}</td>
|
||||
<td class="text-right">{{ score.point_execution }}</td>
|
||||
<td class="text-right">{{ score.point_difficulty }}</td>
|
||||
<td class="text-right">{{ score.point_time_of_flight }}</td>
|
||||
<td class="text-right">{{ score.point_horizontal_displacement }}</td>
|
||||
<td class="text-right">{% if score.penality > 0 %}-{{ score.penality }}{% endif %}</td>
|
||||
<td class="text-right">{{ score.total }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
There are no scores corresponding to your criterias
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="card-footer text-right text-muted pt-0">
|
||||
<a href="{% url 'score_create' %}">
|
||||
<button type="submit" value="add" class="btn btn-icon btn-warning ">
|
||||
<i class="tim-icons icon-simple-add"></i>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footerscript %}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('[data-sort="table"]').tablesorter({
|
||||
headers: {
|
||||
0: { sorter: false },
|
||||
5: { sorter: false },
|
||||
},
|
||||
// dateFormat: "uk",
|
||||
sortList: [[1,0]]
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue