from django.db import models class Room(models.Model): class Meta: verbose_name = 'salle' verbose_name_plural = 'salles' name = models.CharField('nom', max_length=300) latitude = models.DecimalField('latitude', max_digits=11, decimal_places=8) longitude = models.DecimalField('longitude', max_digits=11, decimal_places=8) notes = models.TextField('notes') class Equipment(models.Model): class Meta: verbose_name = 'machine' verbose_name_plural = 'machines' name = models.CharField('nom', max_length=300) room = models.ForeignKey( verbose_name='salle', to=Room, on_delete=models.SET_NULL, related_name='equipments', null=True ) class Setting(models.Model): class Meta: verbose_name = 'réglage' verbose_name_plural = 'réglages' equipment = models.ForeignKey( verbose_name='machine', to=Equipment, on_delete=models.CASCADE, related_name='settings' ) name = models.CharField('nom', max_length=200) value = models.CharField('valeur', max_length=200) class TheoreticalMax(models.Model): class Meta: verbose_name = 'maximum théorique' verbose_name_plural = 'maximums théoriques' equipment = models.ForeignKey( verbose_name='machine', to=Equipment, on_delete=models.CASCADE, related_name='theoretical_maxs' ) date = models.DateField('date') value = models.FloatField('valeur') class Session(models.Model): class Meta: verbose_name = 'séance' verbose_name_plural = 'séances' date = models.DateField('date') room = models.ForeignKey( verbose_name='salle', to=Room, on_delete=models.SET_NULL, related_name='sessions', null=True ) notes = models.TextField('notes') class Round(models.Model): class Meta: verbose_name = 'série' verbose_name_plural = 'séries' repetition_number = models.PositiveIntegerField('nombre de répétitions') equipment = models.ForeignKey( verbose_name='machine', to=Equipment, on_delete=models.CASCADE, related_name='rounds' ) theoretical_max_percentage = models.PositiveIntegerField('pourcentage') chosen_weight = models.FloatField('charge choisie') session = models.ForeignKey( verbose_name='séance', to=Session, on_delete=models.CASCADE, related_name='rounds' ) notes = models.TextField('notes')