diff --git a/api/migrations/0010_trainingentry_order.py b/api/migrations/0010_trainingentry_order.py new file mode 100644 index 0000000..8d7e7e6 --- /dev/null +++ b/api/migrations/0010_trainingentry_order.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.14 on 2021-11-13 09:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0009_auto_20211110_1936'), + ] + + operations = [ + migrations.AddField( + model_name='trainingentry', + name='order', + field=models.IntegerField(default=0), + ), + ] diff --git a/api/models.py b/api/models.py index cdc8a68..cedf8a0 100644 --- a/api/models.py +++ b/api/models.py @@ -123,6 +123,10 @@ class TrainingEntry(models.Model): sets = models.IntegerField() comment = models.CharField(max_length=300, blank=True) exercise = models.ForeignKey(ExerciseType, on_delete=models.CASCADE, related_name='Exercise') + order = models.IntegerField(default=0) + + class Meta: + ordering = ['day', 'order'] def __str__(self): return "Phase " + str(self.phase) + " Week " + str(self.week) + " Day " + str(self.day) + " " + str(self.exercise.name) diff --git a/api/serializers.py b/api/serializers.py index 54903d9..8d45036 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -29,7 +29,8 @@ def id_field(self, training): return training.id class Meta: model = TrainingEntry - fields = ("id", + + fields = ('id', 'user', 'phase', 'week', @@ -38,7 +39,8 @@ class Meta: 'weight', 'sets', 'exercise', - 'comment' + 'comment', + 'order' ) class SetFeedbackSerializer(serializers.ModelSerializer): diff --git a/trainerInterface/templates/trainerInterface/trainPlan.html b/trainerInterface/templates/trainerInterface/trainPlan.html index e1c21dc..e0a4310 100644 --- a/trainerInterface/templates/trainerInterface/trainPlan.html +++ b/trainerInterface/templates/trainerInterface/trainPlan.html @@ -537,6 +537,9 @@ border-radius: 5px; color: #f4eb49; } + .exerciseCell{ + cursor: pointer; + }
@@ -622,7 +625,8 @@ {% for week in phase.weeks.all %} {% for day in week.days.all %} {% endfor %} @@ -853,6 +859,266 @@ +