71 lines
2.1 KiB
Python
71 lines
2.1 KiB
Python
# coding=UTF-8
|
|
|
|
from django.db import models
|
|
|
|
|
|
class Point(models.Model):
|
|
"""
|
|
|
|
"""
|
|
|
|
ROUTINETYPE_CHOICE = ((0, "Routine 1"), (1, "Routine 2"), (2, "Final"))
|
|
|
|
gymnast = models.ForeignKey(
|
|
"people.Gymnast", on_delete=models.CASCADE, default=None
|
|
)
|
|
event = models.ForeignKey("planning.Event", on_delete=models.CASCADE, default=None)
|
|
# routine=models.ForeignKey('objective.Routine')
|
|
routine_type = models.PositiveSmallIntegerField(choices=ROUTINETYPE_CHOICE)
|
|
point_execution = models.DecimalField(max_digits=5, decimal_places=3)
|
|
point_difficulty = models.DecimalField(max_digits=3, decimal_places=1)
|
|
point_time_of_flight = models.DecimalField(max_digits=5, decimal_places=3)
|
|
point_horizontal_displacement = models.DecimalField(max_digits=4, decimal_places=3)
|
|
penality = models.DecimalField(max_digits=3, decimal_places=1)
|
|
total = models.DecimalField(max_digits=6, decimal_places=3)
|
|
|
|
def __str__(self):
|
|
return "%s, %s - %s" % (
|
|
self.gymnast.lastname,
|
|
self.gymnast.firstname,
|
|
self.total,
|
|
)
|
|
|
|
|
|
class Competition(models.Model):
|
|
"""
|
|
Classe représentant une compétition.
|
|
"""
|
|
|
|
name = models.CharField(max_length=255)
|
|
acronym = models.CharField(max_length=10)
|
|
reglement = models.FileField(upload_to="", null=True, blank=True)
|
|
|
|
def __str__(self):
|
|
return "%s (%s)" % (self.name, self.acronym)
|
|
|
|
|
|
class Division(models.Model):
|
|
"""
|
|
Commentaire de la classe Division
|
|
"""
|
|
|
|
competition = models.ForeignKey(Competition, on_delete=models.CASCADE, default=None)
|
|
name = models.CharField(max_length=255)
|
|
acronym = models.CharField(max_length=10)
|
|
|
|
def __str__(self):
|
|
return "%s (%s)" % (self.name, self.acronym)
|
|
|
|
|
|
class Level(models.Model):
|
|
"""
|
|
Commentaire de la classe Division
|
|
"""
|
|
|
|
division = models.ForeignKey(Division, on_delete=models.CASCADE, default=None)
|
|
name = models.CharField(max_length=255)
|
|
acronym = models.CharField(max_length=10)
|
|
|
|
def __str__(self):
|
|
return "%s (%s)" % (self.name, self.acronym)
|