Commit 1316da7f authored by harkamalsi's avatar harkamalsi
Browse files

Fixing completion_date error

parent 0c14671f
......@@ -26,7 +26,7 @@ class Migration(migrations.Migration):
),
("goal", models.TextField()),
("creationDate", models.DateTimeField()),
("completionDate", models.DateTimeField(default=None, null=True)),
("completion_date", models.DateTimeField(default=None, null=True)),
("completed", models.BooleanField()),
(
"athlete",
......
......@@ -12,7 +12,7 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterField(
model_name="athletegoals",
name="completionDate",
name="completion_date",
field=models.DateTimeField(blank=True),
),
]
......@@ -12,6 +12,6 @@ class Migration(migrations.Migration):
operations = [
migrations.RemoveField(
model_name="athletegoals",
name="completionDate",
name="completion_date",
),
]
......@@ -6,13 +6,13 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0012_remove_athletegoals_completionDate"),
("users", "0012_remove_athletegoals_completion_date"),
]
operations = [
migrations.AddField(
model_name="athletegoals",
name="completionDate",
name="completion_date",
field=models.DateTimeField(null=True),
),
]
......@@ -6,13 +6,13 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0013_athletegoals_completionDate"),
("users", "0013_athletegoals_completion_date"),
]
operations = [
migrations.AlterField(
model_name="athletegoals",
name="completionDate",
name="completion_date",
field=models.DateTimeField(default=None, null=True),
),
]
......@@ -26,7 +26,7 @@ class Migration(migrations.Migration):
),
("goal", models.TextField()),
("creation_date", models.DateTimeField()),
("completionDate", models.DateTimeField(default=None, null=True)),
("completion_date", models.DateTimeField(default=None, null=True)),
("completed", models.BooleanField()),
(
"athlete",
......
......@@ -53,7 +53,7 @@ class Goals(models.Model):
athlete: The athlete the goal was created for
goal: The goal that was created
creation_date: When the goal was created
completionDate: When the goal was completed
completion_date: When the goal was completed
completed: If the goal is completed or not
coach: The coach that created the goal
......@@ -64,7 +64,7 @@ class Goals(models.Model):
)
goal = models.TextField()
creation_date = models.DateTimeField()
completionDate = models.DateTimeField(null=True, default=None)
completion_date = models.DateTimeField(null=True, default=None)
completed = models.BooleanField()
coach = models.ForeignKey(
get_user_model(), on_delete=models.CASCADE, related_name="athletes_goals"
......
......@@ -138,7 +138,7 @@ class GoalSerializer(serializers.HyperlinkedModelSerializer):
"athlete",
"goal",
"creationDate",
"completionDate",
"completion_date",
"completed",
]
......@@ -154,7 +154,7 @@ class GoalGetSerializer(serializers.HyperlinkedModelSerializer):
"athlete",
"goal",
"creation_date",
"completionDate",
"completion_date",
"completed",
"coach",
]
......@@ -163,13 +163,13 @@ class GoalGetSerializer(serializers.HyperlinkedModelSerializer):
class GoalPutSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Goals
fields = ["completed", "completionDate"]
fields = ["completed", "completion_date"]
def update(self, instance, validated_data):
completed = validated_data["completed"]
date = validated_data["completionDate"]
date = validated_data["completion_date"]
instance.completed = completed
instance.completionDate = date
instance.completion_date = date
instance.save()
return instance
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment