diff --git a/timelaps/__pycache__/urls.cpython-36.pyc b/timelaps/__pycache__/urls.cpython-36.pyc index 673043d..154f70b 100644 Binary files a/timelaps/__pycache__/urls.cpython-36.pyc and b/timelaps/__pycache__/urls.cpython-36.pyc differ diff --git a/timelaps/__pycache__/views.cpython-36.pyc b/timelaps/__pycache__/views.cpython-36.pyc index 381ccc2..6235d8a 100644 Binary files a/timelaps/__pycache__/views.cpython-36.pyc and b/timelaps/__pycache__/views.cpython-36.pyc differ diff --git a/timelaps/urls.py b/timelaps/urls.py index 1a9098a..a7b0d6d 100644 --- a/timelaps/urls.py +++ b/timelaps/urls.py @@ -9,5 +9,5 @@ urlpatterns = [ path('rules/', ListRulesView.as_view()), path('teams/', ListTeamView.as_view()), path('teampilots/', ListTeamPilotView.as_view()), - url('race/(?P\d+)/team/(?P\d+)/relays', ListRelaysByRaceView.as_view()), + url('race/(?P\d+)/team/(?P\d+)/relays', ListRelaysByRaceAndTeamView.as_view()), ] \ No newline at end of file diff --git a/timelaps/views.py b/timelaps/views.py index 82552d4..c5844c9 100644 --- a/timelaps/views.py +++ b/timelaps/views.py @@ -12,50 +12,36 @@ from .serializers import * class ListDriverView(generics.ListAPIView): """ Provides a get method handler. - """ + """ queryset = Driver.objects.all() serializer_class = DriverSerializer class ListRaceView(generics.ListAPIView): - """ - Provides a get method handler. - """ queryset = Race.objects.all() serializer_class = RaceSerializer class ListRelayView(generics.ListAPIView): - """ - Provides a get method handler. - """ queryset = Relay.objects.all() serializer_class = RelaySerializer class ListRulesView(generics.ListAPIView): - """ - Provides a get method handler. - """ queryset = Rules.objects.all() serializer_class = RulesSerializer class ListTeamView(generics.ListAPIView): - """ - Provides a get method handler. - """ queryset = Team.objects.all() serializer_class = TeamSerializer class ListTeamPilotView(generics.ListAPIView): - """ - Provides a get method handler. - """ queryset = TeamPilot.objects.all() serializer_class = TeamPilotSerializer -class ListRelaysByRaceView(generics.ListAPIView): - ''' + +class ListRelaysByRaceAndTeamView(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"