WIP
This commit is contained in:
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
18
workout/migrations/0007_completedworkout_total_calories.py
Normal file
18
workout/migrations/0007_completedworkout_total_calories.py
Normal file
@@ -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),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -71,6 +71,7 @@ class CompletedWorkout(models.Model):
|
|||||||
total_time = models.IntegerField(null=True, blank=True)
|
total_time = models.IntegerField(null=True, blank=True)
|
||||||
workout_start_time = models.DateTimeField(null=False, blank=False)
|
workout_start_time = models.DateTimeField(null=False, blank=False)
|
||||||
notes = models.TextField(null=False, blank=False)
|
notes = models.TextField(null=False, blank=False)
|
||||||
|
total_calories = models.FloatField(null=True, blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.registered_user.first_name + " : " + self.registered_user.last_name + " : " + self.workout.name + " : " + str(self.difficulty)
|
return self.registered_user.first_name + " : " + self.registered_user.last_name + " : " + self.workout.name + " : " + str(self.difficulty)
|
||||||
@@ -28,7 +28,8 @@ class CompleteWorkoutSerializer(serializers.ModelSerializer):
|
|||||||
difficulty=validated_data['difficulty'],
|
difficulty=validated_data['difficulty'],
|
||||||
total_time=validated_data['total_time'],
|
total_time=validated_data['total_time'],
|
||||||
workout_start_time=validated_data['workout_start_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()
|
completed_workout.save()
|
||||||
return completed_workout
|
return completed_workout
|
||||||
|
|||||||
Reference in New Issue
Block a user