28 lines
894 B
Python
28 lines
894 B
Python
from django.db import models
|
|
from exercise.models import Exercise
|
|
|
|
# Create your models here.
|
|
class MuscleGroup(models.Model):
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
name = models.CharField(null=True, blank=True, max_length=64)
|
|
|
|
def __str__(self):
|
|
return self.name.name
|
|
|
|
class ExerciseMuscleGroup(models.Model):
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
exercise = models.ForeignKey(
|
|
Exercise,
|
|
on_delete=models.CASCADE,
|
|
related_name='exercise_muscle_group_exercise'
|
|
)
|
|
muscle_group = models.ForeignKey(
|
|
MuscleGroup,
|
|
on_delete=models.CASCADE,
|
|
related_name='exercise_muscle_group_muscle_group'
|
|
)
|
|
|
|
def __str__(self):
|
|
return self.exercise.name + " : " + self.muscle_group.name |