mirror of
https://github.com/nprasad2077/nbaStats.git
synced 2026-11-15 22:33:48 +00:00
add top ORB/DRB views and urls
This commit is contained in:
1 parent
38c37a3df2
commit
92cfd0af0f
2 files changed
+23
-1
No files matched your search
+3
-1
@@ -1,5 +1,5 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from .views import PlayerDataList, PlayerDataByTeamList, PlayerDataBySeasonList, PlayerDataByNameList, TopScorersbySeasonList, ThreeTwoTopPointTrends, TopAssistsBySeasonList, TopReboundsBySeasonList, TopBlocksBySeasonList, TopStealsBySeasonList
|
from .views import PlayerDataList, PlayerDataByTeamList, PlayerDataBySeasonList, PlayerDataByNameList, TopScorersbySeasonList, ThreeTwoTopPointTrends, TopAssistsBySeasonList, TopReboundsBySeasonList, TopBlocksBySeasonList, TopStealsBySeasonList, TopOffensiveReboundsBySeasonList, TopDefensiveReboundsBySeasonList
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('api/playerdata/', PlayerDataList.as_view(), name='playerdata_list'),
|
path('api/playerdata/', PlayerDataList.as_view(), name='playerdata_list'),
|
||||||
@@ -12,4 +12,6 @@ urlpatterns = [
|
|||||||
path('api/top_rebounds/<int:season>/', TopReboundsBySeasonList.as_view(), name='top_rebounds'),
|
path('api/top_rebounds/<int:season>/', TopReboundsBySeasonList.as_view(), name='top_rebounds'),
|
||||||
path('api/top_blocks/<int:season>/', TopBlocksBySeasonList.as_view(), name='top_blocks'),
|
path('api/top_blocks/<int:season>/', TopBlocksBySeasonList.as_view(), name='top_blocks'),
|
||||||
path('api/top_steals/<int:season>/', TopStealsBySeasonList.as_view(), name='top_steals'),
|
path('api/top_steals/<int:season>/', TopStealsBySeasonList.as_view(), name='top_steals'),
|
||||||
|
path('api/top_rebounds_offensive/<int:season>/', TopOffensiveReboundsBySeasonList.as_view(), name='top_rebounds_ORB'),
|
||||||
|
path('api/top_rebounds_defensive/<int:season>/', TopDefensiveReboundsBySeasonList.as_view(), name='top_rebounds_DRB'),
|
||||||
]
|
]
|
||||||
@@ -121,3 +121,23 @@ class TopStealsBySeasonList(generics.ListAPIView):
|
|||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
season = self.kwargs['season']
|
season = self.kwargs['season']
|
||||||
return PlayerData.objects.filter(season=season).order_by('-STL')[:20]
|
return PlayerData.objects.filter(season=season).order_by('-STL')[:20]
|
||||||
|
|
||||||
|
# Fetch Top 20 players by ORB DESC for season.
|
||||||
|
|
||||||
|
|
||||||
|
class TopOffensiveReboundsBySeasonList(generics.ListAPIView):
|
||||||
|
serializer_class = PlayerDataSerializer
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
season = self.kwargs['season']
|
||||||
|
return PlayerData.objects.filter(season=season).order_by('-ORB')[:20]
|
||||||
|
|
||||||
|
|
||||||
|
# Fetch Top 20 players by DRB DESC for season.
|
||||||
|
|
||||||
|
class TopDefensiveReboundsBySeasonList(generics.ListAPIView):
|
||||||
|
serializer_class = PlayerDataSerializer
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
season = self.kwargs['season']
|
||||||
|
return PlayerData.objects.filter(season=season).order_by('-DRB')[:20]
|
||||||
Reference in new issue
Block a user