init commit
init commit
This commit is contained in:
28
muscle_group/models.py
Normal file
28
muscle_group/models.py
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
||||
Reference in New Issue
Block a user