Commit 9fb6024d authored by harkamalsi's avatar harkamalsi
Browse files

fixed

parent 1316da7f
......@@ -136,7 +136,9 @@ class Migration(migrations.Migration):
"verbose_name_plural": "users",
"abstract": False,
},
managers=[("objects", django.contrib.auth.models.UserManager()),],
managers=[
("objects", django.contrib.auth.models.UserManager()),
],
),
migrations.CreateModel(
name="Offer",
......
......@@ -11,7 +11,9 @@ class Migration(migrations.Migration):
operations = [
migrations.AddField(
model_name="offer", name="stale", field=models.BooleanField(default=False),
model_name="offer",
name="stale",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="offer",
......@@ -22,5 +24,7 @@ class Migration(migrations.Migration):
max_length=8,
),
),
migrations.DeleteModel(name="OfferResponse",),
migrations.DeleteModel(
name="OfferResponse",
),
]
......@@ -54,7 +54,9 @@ class Migration(migrations.Migration):
),
),
],
options={"abstract": False,},
options={
"abstract": False,
},
),
migrations.CreateModel(
name="CoachRequest",
......@@ -98,7 +100,11 @@ class Migration(migrations.Migration):
),
),
],
options={"abstract": False,},
options={
"abstract": False,
},
),
migrations.DeleteModel(
name="Offer",
),
migrations.DeleteModel(name="Offer",),
]
......@@ -67,8 +67,14 @@ class Migration(migrations.Migration):
("timestamp", models.DateTimeField(auto_now_add=True)),
],
),
migrations.RemoveField(model_name="coachrequest", name="owner",),
migrations.RemoveField(model_name="coachrequest", name="recipient",),
migrations.RemoveField(
model_name="coachrequest",
name="owner",
),
migrations.RemoveField(
model_name="coachrequest",
name="recipient",
),
migrations.AlterField(
model_name="user",
name="coach",
......@@ -80,8 +86,12 @@ class Migration(migrations.Migration):
to=settings.AUTH_USER_MODEL,
),
),
migrations.DeleteModel(name="AthleteRequest",),
migrations.DeleteModel(name="CoachRequest",),
migrations.DeleteModel(
name="AthleteRequest",
),
migrations.DeleteModel(
name="CoachRequest",
),
migrations.AddField(
model_name="offer",
name="owner",
......
......@@ -10,6 +10,12 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RemoveField(model_name="offer", name="offer_type",),
migrations.RemoveField(model_name="offer", name="stale",),
migrations.RemoveField(
model_name="offer",
name="offer_type",
),
migrations.RemoveField(
model_name="offer",
name="stale",
),
]
......@@ -26,7 +26,7 @@ class Migration(migrations.Migration):
),
("goal", models.TextField()),
("creationDate", models.DateTimeField()),
("completion_date", models.DateTimeField(default=None, null=True)),
("completionDate", 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="completion_date",
name="completionDate",
field=models.DateTimeField(blank=True),
),
]
......@@ -12,6 +12,6 @@ class Migration(migrations.Migration):
operations = [
migrations.RemoveField(
model_name="athletegoals",
name="completion_date",
name="completionDate",
),
]
......@@ -6,13 +6,13 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0012_remove_athletegoals_completion_date"),
("users", "0012_remove_athletegoals_completiondate"),
]
operations = [
migrations.AddField(
model_name="athletegoals",
name="completion_date",
name="completionDate",
field=models.DateTimeField(null=True),
),
]
......@@ -6,13 +6,13 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0013_athletegoals_completion_date"),
("users", "0013_athletegoals_completiondate"),
]
operations = [
migrations.AlterField(
model_name="athletegoals",
name="completion_date",
name="completionDate",
field=models.DateTimeField(default=None, null=True),
),
]
......@@ -137,9 +137,10 @@ class GoalSerializer(serializers.HyperlinkedModelSerializer):
"id",
"athlete",
"goal",
"creationDate",
"creation_date",
"completion_date",
"completed",
"coach",
]
def create(self, validated_data):
......@@ -147,6 +148,7 @@ class GoalSerializer(serializers.HyperlinkedModelSerializer):
class GoalGetSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Goals
fields = [
"url",
......
......@@ -214,7 +214,11 @@ class GoalsList(
serializer_class = GoalSerializer
permission_classes = [permissions.IsAuthenticated]
filter_backends = [filters.OrderingFilter]
ordering_fields = ["completed", "completion_date"]
def get(self, request, *args, **kwargs):
return self.list(request, *args, **kwargs)
def post(self, request, *args, **kwargs):
return self.create(request, *args, **kwargs)
......@@ -240,3 +244,20 @@ class GoalsDetail(
generics.GenericAPIView,
):
serializer_class = GoalSerializer
queryset = Goals.objects.all()
permission_classes = [permissions.IsAuthenticated]
def get(self, request, *args, **kwargs):
self.serializer_class = GoalGetSerializer
return self.retrieve(request, *args, **kwargs)
def delete(self, request, *args, **kwargs):
return self.destroy(request, *args, **kwargs)
def put(self, request, *args, **kwargs):
self.serializer_class = GoalPutSerializer
return self.update(request, *args, **kwargs)
def patch(self, request, *args, **kwargs):
return self.partial_update(request, *args, **kwargs)
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