1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-24 03:48:47 +02:00

Add position field for passages

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-04-07 00:05:56 +02:00
parent 1ed4e9c17a
commit 7dc812984b
7 changed files with 168 additions and 85 deletions

View File

@ -6,7 +6,7 @@ import os
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator
from django.core.validators import MaxValueValidator, MinValueValidator, RegexValidator
from django.db import models
from django.db.models import Index
from django.urls import reverse_lazy
@ -431,6 +431,13 @@ class Passage(models.Model):
related_name="passages",
)
position = models.PositiveSmallIntegerField(
verbose_name=_("position"),
choices=zip(range(1, 6), range(1, 6)),
default=1,
validators=[MinValueValidator(1), MaxValueValidator(5)],
)
solution_number = models.PositiveSmallIntegerField(
verbose_name=_("defended solution"),
choices=[
@ -539,6 +546,7 @@ class Passage(models.Model):
class Meta:
verbose_name = _("passage")
verbose_name_plural = _("passages")
ordering = ('pool', 'position',)
class Tweak(models.Model):