diff --git a/nba_data/urls.py b/nba_data/urls.py index dbdf7fc..cc5aaa5 100644 --- a/nba_data/urls.py +++ b/nba_data/urls.py @@ -1,5 +1,5 @@ from django.urls import path -from .views import PlayerDataList, PlayerDataByTeamList, PlayerDataBySeasonList, PlayerDataByNameList, TopScorersbySeasonList +from .views import PlayerDataList, PlayerDataByTeamList, PlayerDataBySeasonList, PlayerDataByNameList, TopScorersbySeasonList, ThreeTwoTopPointTrends urlpatterns = [ path('api/playerdata/', PlayerDataList.as_view(), name='playerdata_list'), @@ -7,4 +7,5 @@ urlpatterns = [ path('api/playerdata/season//', PlayerDataBySeasonList.as_view(), name='playerdata_by_season'), path('api/playerdata/name//', PlayerDataByNameList.as_view(), name='playerdata_by_name'), path('api/playerdata/topscorers/season//', TopScorersbySeasonList.as_view(), name='top_scorers_by_season'), + path('api/three_two_point_trends/', ThreeTwoTopPointTrends.as_view(), name='three_two_point_trends'), ] \ No newline at end of file diff --git a/nba_data/views.py b/nba_data/views.py index 20876d7..3bc911c 100644 --- a/nba_data/views.py +++ b/nba_data/views.py @@ -56,7 +56,7 @@ class TopScorersbySeasonList(generics.ListAPIView): # Fetch and calculate the average 3P made, 3P attemps, 2P made, 2P attempts for all players in each season. # Will use APIview here instead of generics.ListAPIView to avoid having to create a serializer to generate the queryset. avg_three_made and avg_two_made are new data points at the time of creation when compared to the per_game model. -class ThreeTopPointTrends(APIView): +class ThreeTwoTopPointTrends(APIView): def get(self, request, format=None): seasons = PlayerData.objects.values_list( 'season', flat=True).distinct().order_by('season')