Update admin and closure tree

This commit is contained in:
Gregory Trullemans 2022-10-18 08:21:27 +02:00
parent 8a89eb0729
commit 69cd14b440
4 changed files with 36 additions and 6 deletions

View File

@ -73,7 +73,7 @@ class SkillAdmin(admin.ModelAdmin):
)
ordering = ("long_label", "short_label")
search_fields = ("rank", "long_label", "short_label")
search_fields = ("rank", "long_label", "short_label", "notation")
list_filter = (
"is_competitive",
('difficulty', DropdownFilter),

View File

@ -13,8 +13,10 @@ from ultron.objective.models import Educative, PrerequisiteClosure
class Command(BaseCommand):
def handle(self, *args, **options):
educative_list = Educative.objects.all()
count = 0
for educative in educative_list:
count += 1
updated = False
max_level = 0
max_rank = 0

View File

@ -0,0 +1,33 @@
# Generated by Django 4.1.1 on 2022-10-18 04:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("objective", "0013_alter_skill_position"),
]
operations = [
migrations.AlterField(
model_name="skill",
name="notation",
field=models.CharField(max_length=10),
),
migrations.AlterField(
model_name="skill",
name="rotation",
field=models.PositiveSmallIntegerField(verbose_name="¼ de rotation"),
),
migrations.AlterField(
model_name="skill",
name="simplified_notation",
field=models.CharField(max_length=10, verbose_name="Notation simplifiée"),
),
migrations.AlterField(
model_name="skill",
name="twist",
field=models.PositiveSmallIntegerField(verbose_name="½ Vrille"),
),
]

View File

@ -460,11 +460,6 @@ def gymnast_display_skill(request, gymnast_id):
context = gymnast.get_informations_from_type("level")
context.update(gymnast.get_informations_from_type("rank"))
# planned_skill = (
# Plan.objects.filter(gymnast=gymnast.id, educative__in=(Skill.objects.all()))
# .order_by("-date", 'educative__long_label')
# )
planned_skill = (
Plan.objects.filter(gymnast=gymnast.id, educative__in=(Skill.objects.all())).select_related('educative', 'educative__skill')
.order_by("-date", 'educative__long_label')