From 3aa52bbb6a7a631b500da7d5fc877788b4ef6cce Mon Sep 17 00:00:00 2001 From: bglacial Date: Mon, 14 Jan 2019 21:54:31 +0100 Subject: [PATCH] Ajout de commentaires --- timelaps/serializers.py | 3 +++ timelaps/views.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/timelaps/serializers.py b/timelaps/serializers.py index 922d985..a22255a 100644 --- a/timelaps/serializers.py +++ b/timelaps/serializers.py @@ -36,5 +36,8 @@ class RelayPilotSerializer(serializers.ModelSerializer): model = Relay #fields = ('relay_start','relay_end','has_refuel','pilot_chrono','comment','team_pilot','race') fields = '__all__' + ''' + To get linked elements référenced by a foreign key, use depth to adjust the depth of the request. + ''' depth = 2 \ No newline at end of file diff --git a/timelaps/views.py b/timelaps/views.py index cf14d4f..82552d4 100644 --- a/timelaps/views.py +++ b/timelaps/views.py @@ -52,6 +52,10 @@ class ListTeamPilotView(generics.ListAPIView): serializer_class = TeamPilotSerializer class ListRelaysByRaceView(generics.ListAPIView): + ''' + Getting the params from the url with the "self.kwargs.get" + and filter with thoses in the relays relation + ''' serializer_class = RelayPilotSerializer lookup_url_raceid = "raceid" lookup_url_teamid = "teamid"