mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-21 09:18:23 +02:00
Add position field for passages
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -323,7 +323,7 @@ class PassageForm(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = Passage
|
||||
fields = ('solution_number', 'defender', 'opponent', 'reporter', 'defender_penalties',)
|
||||
fields = ('position', 'solution_number', 'defender', 'opponent', 'reporter', 'defender_penalties',)
|
||||
|
||||
|
||||
class SynthesisForm(forms.ModelForm):
|
||||
|
@ -0,0 +1,44 @@
|
||||
# Generated by Django 4.2 on 2023-04-06 22:05
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("participation", "0005_alter_team_options"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name="passage",
|
||||
options={
|
||||
"ordering": ("pool", "position"),
|
||||
"verbose_name": "passage",
|
||||
"verbose_name_plural": "passages",
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="passage",
|
||||
name="position",
|
||||
field=models.PositiveSmallIntegerField(
|
||||
choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)],
|
||||
default=1,
|
||||
validators=[
|
||||
django.core.validators.MinValueValidator(1),
|
||||
django.core.validators.MaxValueValidator(5),
|
||||
],
|
||||
verbose_name="position",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="participation",
|
||||
name="valid",
|
||||
field=models.BooleanField(
|
||||
default=None,
|
||||
help_text="The participation got the validation of the organizers.",
|
||||
null=True,
|
||||
verbose_name="valid team",
|
||||
),
|
||||
),
|
||||
]
|
@ -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):
|
||||
|
@ -13,6 +13,9 @@
|
||||
<dt class="col-sm-3">{% trans "Pool:" %}</dt>
|
||||
<dd class="col-sm-9"><a href="{{ passage.pool.get_absolute_url }}">{{ passage.pool }}</a></dd>
|
||||
|
||||
<dt class="col-sm-3">{% trans "Position:" %}</dt>
|
||||
<dd class="col-sm-9">{{ passage.position }}</dd>
|
||||
|
||||
<dt class="col-sm-3">{% trans "Defender:" %}</dt>
|
||||
<dd class="col-sm-9"><a href="{{ passage.defender.get_absolute_url }}">{{ passage.defender.team }}</a></dd>
|
||||
|
||||
|
Reference in New Issue
Block a user