diff --git a/db.sqlite3 b/db.sqlite3 index 2498808..8cb3e71 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/workout/admin.py b/workout/admin.py index 2dd4c84..92a26b1 100644 --- a/workout/admin.py +++ b/workout/admin.py @@ -21,5 +21,5 @@ class WorkoutExerciseAdmin(admin.ModelAdmin): @admin.register(CompletedWorkout) class CompletedWorkoutAdmin(admin.ModelAdmin): - list_display = ("registered_user", "workout", "difficulty", "created_at",) + list_display = ("registered_user", "workout", "workout_start_time", "difficulty", "notes", "total_time", "created_at",) \ No newline at end of file diff --git a/workout/migrations/0005_completedworkout_total_time_and_more.py b/workout/migrations/0005_completedworkout_total_time_and_more.py new file mode 100644 index 0000000..1ef07c4 --- /dev/null +++ b/workout/migrations/0005_completedworkout_total_time_and_more.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.2 on 2023-06-22 02:08 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workout', '0004_workoutexercise_duration'), + ] + + operations = [ + migrations.AddField( + model_name='completedworkout', + name='total_time', + field=models.IntegerField(blank=True, null=True), + ), + migrations.AddField( + model_name='completedworkout', + name='workout_start_time', + field=models.DateTimeField(default=datetime.datetime(2023, 6, 22, 2, 8, 12, 885580)), + preserve_default=False, + ), + ] diff --git a/workout/migrations/0006_completedworkout_notes.py b/workout/migrations/0006_completedworkout_notes.py new file mode 100644 index 0000000..ba429f5 --- /dev/null +++ b/workout/migrations/0006_completedworkout_notes.py @@ -0,0 +1,19 @@ +# Generated by Django 4.2.2 on 2023-06-22 03:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('workout', '0005_completedworkout_total_time_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='completedworkout', + name='notes', + field=models.TextField(default=''), + preserve_default=False, + ), + ] diff --git a/workout/models.py b/workout/models.py index b1a089e..099fff0 100644 --- a/workout/models.py +++ b/workout/models.py @@ -68,6 +68,9 @@ class CompletedWorkout(models.Model): difficulty = models.PositiveSmallIntegerField( choices=WORKOUT_LEVEL ) + total_time = models.IntegerField(null=True, blank=True) + workout_start_time = models.DateTimeField(null=False, blank=False) + notes = models.TextField(null=False, blank=False) 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 ced6f84..da0cdb0 100644 --- a/workout/serializers.py +++ b/workout/serializers.py @@ -25,7 +25,9 @@ class CompleteWorkoutSerializer(serializers.ModelSerializer): completed_workout = CompletedWorkout.objects.create( registered_user=registered_user, workout=validated_data['workout'], - difficulty=validated_data['difficulty'] + difficulty=validated_data['difficulty'], + total_time=validated_data['total_time'], + workout_start_time=validated_data['workout_start_time'] ) completed_workout.save() return completed_workout