diff --git a/db.sqlite3 b/db.sqlite3 index de38eb6..849f15b 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/workout/migrations/0007_completedworkout_total_calories.py b/workout/migrations/0007_completedworkout_total_calories.py new file mode 100644 index 0000000..2a493d3 --- /dev/null +++ b/workout/migrations/0007_completedworkout_total_calories.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.2 on 2023-06-24 04:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workout', '0006_completedworkout_notes'), + ] + + operations = [ + migrations.AddField( + model_name='completedworkout', + name='total_calories', + field=models.FloatField(blank=True, null=True), + ), + ] diff --git a/workout/models.py b/workout/models.py index 099fff0..4245ffb 100644 --- a/workout/models.py +++ b/workout/models.py @@ -71,6 +71,7 @@ class CompletedWorkout(models.Model): total_time = models.IntegerField(null=True, blank=True) workout_start_time = models.DateTimeField(null=False, blank=False) notes = models.TextField(null=False, blank=False) + total_calories = models.FloatField(null=True, blank=True) def __str__(self): return self.registered_user.first_name + " : " + self.registered_user.last_name + " : " + self.workout.name + " : " + str(self.difficulty) \ No newline at end of file diff --git a/workout/serializers.py b/workout/serializers.py index 72e2741..6be783e 100644 --- a/workout/serializers.py +++ b/workout/serializers.py @@ -28,7 +28,8 @@ class CompleteWorkoutSerializer(serializers.ModelSerializer): difficulty=validated_data['difficulty'], total_time=validated_data['total_time'], workout_start_time=validated_data['workout_start_time'], - notes=validated_data['notes'] + notes=validated_data['notes'], + total_calories=validated_data['total_calories'] ) completed_workout.save() return completed_workout