From 2dc99c24b93679b20a631d4de50d78b593c091bd Mon Sep 17 00:00:00 2001 From: nprasad2077 <114438461+nprasad2077@users.noreply.github.com> Date: Wed, 3 May 2023 23:20:30 -0500 Subject: [PATCH] defensive views --- nba_data/views.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/nba_data/views.py b/nba_data/views.py index 8071720..8504d5a 100644 --- a/nba_data/views.py +++ b/nba_data/views.py @@ -122,6 +122,17 @@ class TopReboundsBySeasonList(generics.ListAPIView): def get_queryset(self): season = self.kwargs['season'] return PlayerData.objects.filter(season=season).order_by('-TRB')[:20] + +# Fetch top 20 players by TRB Totals for season. + +class TopReboundsbySeasonTotalsList(generics.ListAPIView): + serializer_class = PlayerTotalsDataSerializer + + def get_queryset(self): + season = self.kwargs['season'] + return PlayerTotalsData.objects.filter(season=season).order_by('-TRB')[:20] + + # Fetch Top 20 players by BLK DESC for specified season. @@ -133,6 +144,18 @@ class TopBlocksBySeasonList(generics.ListAPIView): season = self.kwargs['season'] return PlayerData.objects.filter(season=season).order_by('-BLK')[:20] + + +# Fetch Top 20 players by BLK totals DESC for specified season. + +class TopBlocksbySeasonTotalsList(generics.ListAPIView): + serializer_class = PlayerTotalsDataSerializer + + def get_queryset(self): + season = self.kwargs['season'] + return PlayerTotalsData.objects.filter(season=season).order_by('-BLK')[:20] + + # Fetch Top 20 players by STL DESC for season specified. @@ -143,6 +166,16 @@ class TopStealsBySeasonList(generics.ListAPIView): season = self.kwargs['season'] return PlayerData.objects.filter(season=season).order_by('-STL')[:20] +# Fetch Top 20 players by STL totals DESC for season specified. + +class TopStealsbySeasonTotalsList(generics.ListAPIView): + serializer_class = PlayerTotalsDataSerializer + + def get_queryset(self): + season = self.kwargs['season'] + return PlayerTotalsData.objects.filter(season=season).order_by('-STL')[:20] + + # Fetch Top 20 players by ORB DESC for season. @@ -152,6 +185,15 @@ class TopOffensiveReboundsBySeasonList(generics.ListAPIView): def get_queryset(self): season = self.kwargs['season'] return PlayerData.objects.filter(season=season).order_by('-ORB')[:20] + +# Fetch Top 20 players by ORB totals DESC for season. + +class TopOffensiveReboundsbySeasonTotalsList(generics.ListAPIView): + serializer_class = PlayerTotalsDataSerializer + + def get_queryset(self): + season = self.kwargs['season'] + return PlayerTotalsData.objects.filter(season=season).order_by('-ORB')[:20] # Fetch Top 20 players by DRB DESC for season. @@ -163,6 +205,15 @@ class TopDefensiveReboundsBySeasonList(generics.ListAPIView): season = self.kwargs['season'] return PlayerData.objects.filter(season=season).order_by('-DRB')[:20] +# Fetch Top 20 players by DRB totals DESC for season. + +class TopDefensiveReboundsBySeasonTotalsList(generics.ListAPIView): + serializer_class = PlayerTotalsDataSerializer + + def get_queryset(self): + season = self.kwargs['season'] + return PlayerTotalsDataSerializer.objects.filter(season=season).order_by('-DRB')[:20] + # PTS Histogram