From 16486064ce11477c2356020f2c9969f6bd7e3780 Mon Sep 17 00:00:00 2001 From: Trullemans Gregory Date: Sun, 5 Dec 2021 12:43:30 +0100 Subject: [PATCH] Minor improvement --- khana/objective/admin.py | 14 +- khana/objective/forms.py | 6 +- .../migrations/0018_auto_20211205_1133.py | 22 ++ khana/objective/models.py | 6 +- khana/objective/urls.py | 2 +- .../0022_alter_event_participation_options.py | 17 ++ requirements/dev.txt | 2 + requirements/with-mysql.txt | 4 - templates/accident_create.html | 117 ---------- templates/accident_details.html | 36 ---- templates/accident_list.html | 75 ------- templates/score_create.html | 200 ------------------ templates/score_list.html | 79 ------- 13 files changed, 55 insertions(+), 525 deletions(-) create mode 100644 khana/objective/migrations/0018_auto_20211205_1133.py create mode 100644 khana/planning/migrations/0022_alter_event_participation_options.py delete mode 100644 requirements/with-mysql.txt delete mode 100644 templates/accident_create.html delete mode 100644 templates/accident_details.html delete mode 100644 templates/accident_list.html delete mode 100644 templates/score_create.html delete mode 100644 templates/score_list.html diff --git a/khana/objective/admin.py b/khana/objective/admin.py index af82f74..39be7b5 100644 --- a/khana/objective/admin.py +++ b/khana/objective/admin.py @@ -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", ) diff --git a/khana/objective/forms.py b/khana/objective/forms.py index f56c214..55e98c6 100644 --- a/khana/objective/forms.py +++ b/khana/objective/forms.py @@ -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(), diff --git a/khana/objective/migrations/0018_auto_20211205_1133.py b/khana/objective/migrations/0018_auto_20211205_1133.py new file mode 100644 index 0000000..6afa9ec --- /dev/null +++ b/khana/objective/migrations/0018_auto_20211205_1133.py @@ -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', + ), + ] diff --git a/khana/objective/models.py b/khana/objective/models.py index 59275e7..cb450d7 100644 --- a/khana/objective/models.py +++ b/khana/objective/models.py @@ -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): """ diff --git a/khana/objective/urls.py b/khana/objective/urls.py index 57e71cf..44e5fd7 100644 --- a/khana/objective/urls.py +++ b/khana/objective/urls.py @@ -7,7 +7,7 @@ from . import views # Skills skill_urlpatterns = [ re_path( - r"^(?P(level|rank|difficulty|landing|rotation|departure|twist))/(?P[\w]+)/(?P[\w]+)$", + r"^(?P(level|rank|difficulty))/(?P[\w]+)/(?P[\w]+)$", views.skill_listing, name="skill_listing_by_key", ), diff --git a/khana/planning/migrations/0022_alter_event_participation_options.py b/khana/planning/migrations/0022_alter_event_participation_options.py new file mode 100644 index 0000000..4c90b06 --- /dev/null +++ b/khana/planning/migrations/0022_alter_event_participation_options.py @@ -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'}, + ), + ] diff --git a/requirements/dev.txt b/requirements/dev.txt index 95ca46c..fac8519 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -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 diff --git a/requirements/with-mysql.txt b/requirements/with-mysql.txt deleted file mode 100644 index 0fdf042..0000000 --- a/requirements/with-mysql.txt +++ /dev/null @@ -1,4 +0,0 @@ --r dev.txt - -mysqlclient==2.0.3 -sqlparse==0.4.1 diff --git a/templates/accident_create.html b/templates/accident_create.html deleted file mode 100644 index ce4cbbf..0000000 --- a/templates/accident_create.html +++ /dev/null @@ -1,117 +0,0 @@ -{% extends "base.html" %} - -{% block content %} -
-
-
-
-

{% if accidentid %}Edit{% else %}Add{% endif %} accident

-
-
-
- {% csrf_token %} -
- -
- {{ form.date }} - {% if form.date.errors %}{% for error in form.date.errors %}{{error}}{% endfor %}{% endif %} -
-
-
- -
- {{ form.gymnast }} - {{ form.gymnast_related }} - {% if form.gymnast.errors %} {% for error in form.gymnast.errors %}{{error}}{% endfor %}{% endif %} -
-
-
- -
- {{ form.educative }} - {{ form.educative_related }} - {% if form.educative.errors %} {% for error in form.educative.errors %}{{error}}{% endfor %}{% endif %} -
-
-
- -
- {{ form.content }} -
-
-
- -
-
-
-
-
-
- - - -{% endblock %} \ No newline at end of file diff --git a/templates/accident_details.html b/templates/accident_details.html deleted file mode 100644 index f71d736..0000000 --- a/templates/accident_details.html +++ /dev/null @@ -1,36 +0,0 @@ -{% extends "base.html" %} - - - - - -{% block content %} - -
-
-
-
-

Accident : {{ accident.date | date:"d-m-Y" }}

-
-
- {{ accident.gymnast }} -
- {{ accident.educative }} -
-
- - {{ accident.to_markdown | safe }} - - -
-
-
-
- -{% endblock %} \ No newline at end of file diff --git a/templates/accident_list.html b/templates/accident_list.html deleted file mode 100644 index 0539a57..0000000 --- a/templates/accident_list.html +++ /dev/null @@ -1,75 +0,0 @@ -{% extends "listing.html" %} - - - -{% block datacontent %} -
-
-

Accidents' Listing

-
-
-
- {% if accident_list.count >= 1 %} - - - - - - - - - - - {% for accident in accident_list %} - - - - - - - {% endfor %} - -
DateGymnastSkill
- - - - {{ accident.date | date:"d-m-Y" }}{{ accident.gymnast }}{{ accident.educative.notation }} ({{ accident.educative.shortLabel }})
- {% else %} - - - - -
There are no accident corresponding to your criterias
- {% endif %} -
-
- -
-{% endblock %} - -{% block footerscript %} - -{% endblock %} \ No newline at end of file diff --git a/templates/score_create.html b/templates/score_create.html deleted file mode 100644 index ca94aa5..0000000 --- a/templates/score_create.html +++ /dev/null @@ -1,200 +0,0 @@ -{% extends "base.html" %} - -{% block content %} - -
-
-
-
-

{% if scoreid %}Edit{% else %}Add{% endif %} score

-
-
-
- {% csrf_token %} -
- -
- {{ form.gymnast }} - {{ form.gymnast_related }} - {% if form.gymnast.errors %} - - {% endif %} -
-
-
- -
- {{ form.event }} - {{ form.event_related }} - {% if form.event.errors %} - - {% endif %} -
-
-
- -
- {{ form.routine_type }} - {% if form.routine_type.errors %} - - {% endif %} -
-
- -
- -
- {{ form.point_difficulty }} - {% if form.point_difficulty.errors %} - - {% endif %} -
-
-
- -
- {{ form.point_time_of_flight }} - {% if form.point_time_of_flight.errors %} - - {% endif %} -
-
-
- -
- {{ form.point_execution }} - {% if form.point_execution.errors %} - - {% endif %} -
-
- -
- -
- {{ form.point_horizontal_displacement }} - {% if form.point_horizontal_displacement.errors %} - - {% endif %} -
-
-
- -
- {{ form.penality }} - {% if form.penality.errors %} - - {% endif %} -
-
-
- -
- {{ form.total }} - {% if form.total.errors %} - - {% endif %} -
-
-
- -
-
-
-
-
-
-{% endblock %} - -{% block footerscript %} - -{% endblock %} \ No newline at end of file diff --git a/templates/score_list.html b/templates/score_list.html deleted file mode 100644 index a137e7a..0000000 --- a/templates/score_list.html +++ /dev/null @@ -1,79 +0,0 @@ -{% extends "listing.html" %} - -{% load format %} - -{% block datacontent %} -
-
-
-
-

Scores' list

-
-
- {% if score_list.count >= 1 %} - - - - - - - - - - - - - - - - - {% for score in score_list %} - - - - - - - - - - - - - {% endfor %} - -
GymnastEventRoutineExe.Dif.ToFHDPen.Total
- - - - {{ score.gymnast }}{{ score.event.name }}{{ score.get_routine_type_display }}{{ score.point_execution }}{{ score.point_difficulty }}{{ score.point_time_of_flight }}{{ score.point_horizontal_displacement }}{% if score.penality > 0 %}-{{ score.penality }}{% endif %}{{ score.total }}
- {% else %} - There are no scores corresponding to your criterias - {% endif %} -
- -
-
-
-{% endblock %} - -{% block footerscript %} - -{% endblock %}