init commit
This commit is contained in:
30
equipment/models.py
Normal file
30
equipment/models.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from django.db import models
|
||||
from exercise.models import Exercise
|
||||
|
||||
# Create your models here.
|
||||
class Equipment(models.Model):
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
is_weight = models.BooleanField(default=False)
|
||||
category = models.CharField(null=True, blank=True, max_length=64)
|
||||
name = models.CharField(null=True, blank=True, max_length=64)
|
||||
|
||||
def __str__(self):
|
||||
return self.category + " : " + self.name
|
||||
|
||||
class WorkoutEquipment(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='workout_exercise_workout'
|
||||
)
|
||||
equipment = models.ForeignKey(
|
||||
Equipment,
|
||||
on_delete=models.CASCADE,
|
||||
related_name='workout_exercise_workout'
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.exercise.name + " : " + self.equipment.name
|
||||
Reference in New Issue
Block a user