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

fixed

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