mirror of
https://github.com/nprasad2077/nbaStats.git
synced 2026-11-06 18:10:39 +00:00
add views and urls for TRB, BLK, STL
This commit is contained in:
1 parent
2241f2d485
commit
38c37a3df2
2 files changed
+39
-4
No files matched your search
+5
-2
@@ -1,5 +1,5 @@
|
||||
from django.urls import path
|
||||
from .views import PlayerDataList, PlayerDataByTeamList, PlayerDataBySeasonList, PlayerDataByNameList, TopScorersbySeasonList, ThreeTwoTopPointTrends, TopAssistsBySeasonList
|
||||
from .views import PlayerDataList, PlayerDataByTeamList, PlayerDataBySeasonList, PlayerDataByNameList, TopScorersbySeasonList, ThreeTwoTopPointTrends, TopAssistsBySeasonList, TopReboundsBySeasonList, TopBlocksBySeasonList, TopStealsBySeasonList
|
||||
|
||||
urlpatterns = [
|
||||
path('api/playerdata/', PlayerDataList.as_view(), name='playerdata_list'),
|
||||
@@ -8,5 +8,8 @@ urlpatterns = [
|
||||
path('api/playerdata/name/<str:name>/', PlayerDataByNameList.as_view(), name='playerdata_by_name'),
|
||||
path('api/playerdata/topscorers/season/<str:season>/', TopScorersbySeasonList.as_view(), name='top_scorers_by_season'),
|
||||
path('api/three_two_point_trends/', ThreeTwoTopPointTrends.as_view(), name='three_two_point_trends'),
|
||||
path('api/top_assists/<int:season>/', TopAssistsBySeasonList.as_view(), name='top_assists')
|
||||
path('api/top_assists/<int:season>/', TopAssistsBySeasonList.as_view(), name='top_assists'),
|
||||
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_steals/<int:season>/', TopStealsBySeasonList.as_view(), name='top_steals'),
|
||||
]
|
||||
+34
-2
@@ -81,11 +81,43 @@ class ThreeTwoTopPointTrends(APIView):
|
||||
})
|
||||
|
||||
return Response(data)
|
||||
|
||||
|
||||
# Fetch Top 20 players by AST DESC for season specified.
|
||||
|
||||
|
||||
class TopAssistsBySeasonList(generics.ListAPIView):
|
||||
serializer_class = PlayerDataSerializer
|
||||
|
||||
|
||||
def get_queryset(self):
|
||||
season = self.kwargs['season']
|
||||
return PlayerData.objects.filter(season=season).order_by('-AST')[:20]
|
||||
|
||||
# Fetch Top 20 players by TRB DESC for season specified.
|
||||
|
||||
|
||||
class TopReboundsBySeasonList(generics.ListAPIView):
|
||||
serializer_class = PlayerDataSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
season = self.kwargs['season']
|
||||
return PlayerData.objects.filter(season=season).order_by('-TRB')[:20]
|
||||
|
||||
# Fetch Top 20 players by BLK DESC for specified season.
|
||||
|
||||
|
||||
class TopBlocksBySeasonList(generics.ListAPIView):
|
||||
serializer_class = PlayerDataSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
season = self.kwargs['season']
|
||||
return PlayerData.objects.filter(season=season).order_by('-BLK')[:20]
|
||||
|
||||
# Fetch Top 20 players by STL DESC for season specified.
|
||||
|
||||
|
||||
class TopStealsBySeasonList(generics.ListAPIView):
|
||||
serializer_class = PlayerDataSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
season = self.kwargs['season']
|
||||
return PlayerData.objects.filter(season=season).order_by('-STL')[:20]
|
||||
Reference in new issue
Block a user