workouttest_backoffice/aitrainer_backoffice/aitrainer_backoffice/models/exercise_plan.py

51 lines
1.9 KiB
Python

from django.db import models
from django.utils.translation import ugettext_lazy as _
from .enums import LanguageTypes
from .exercise_type import ExerciseType
class ExercisePlan(models.Model):
exercise_plan_id = models.AutoField(primary_key=True)
name = models.CharField(max_length=100, help_text='The name should be in English here')
description = models.TextField(max_length=1000, blank=True, null=True, help_text='The description should be in '
'English here')
class Meta:
db_table = 'exercise_plan'
verbose_name = _("Exercise Plan")
verbose_name_plural = _("Exercise Plans")
def __str__(self):
return self.name
class ExercisePlanTranslation(models.Model):
translation_id = models.AutoField(primary_key=True)
exercise_plan = models.ForeignKey(ExercisePlan, on_delete=models.CASCADE)
language_code = models.CharField(max_length=2, choices=LanguageTypes.choices, default=LanguageTypes.HU)
name = models.CharField(max_length=100)
description = models.TextField(max_length=1000, blank=True, null=True)
class Meta:
db_table = 'exercise_plan_translation'
verbose_name = _("Translation")
verbose_name_plural = _("Translations")
def __str__(self):
return self.name
class ExercisePlanDetail(models.Model):
exercise_plan_detail_id = models.AutoField(primary_key=True)
exercise_plan = models.ForeignKey(ExercisePlan, on_delete=models.CASCADE)
exercise_type = models.ForeignKey(ExerciseType, on_delete=models.CASCADE)
serie = models.IntegerField()
repeats = models.IntegerField()
weight_equation = models.CharField(max_length=100)
class Meta:
db_table = 'exercise_plan_detail'
verbose_name = _("Exercise Plan Detail")
verbose_name_plural = _("Exercise Plan Details")