mirror of
https://github.com/nprasad2077/nbaStats.git
synced 2026-11-07 02:20:33 +00:00
add views for player name and season
This commit is contained in:
1 parent
a1e0443f7c
commit
135f3cbfb9
2 files changed
+29
-1
No files matched your search
@@ -15,3 +15,28 @@ class PlayerDataList(generics.ListCreateAPIView):
|
||||
# pagination_class = None
|
||||
|
||||
|
||||
# Fetch player data by team
|
||||
class PlayerDataByTeamList(generics.ListAPIView):
|
||||
serializer_class = PlayerDataSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
team = self.kwargs['team']
|
||||
return PlayerData.objects.filter(team=team)
|
||||
|
||||
|
||||
# Fetch player data by season
|
||||
class PlayerDataBySeasonList(generics.ListAPIView):
|
||||
serializer_class = PlayerDataSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
season = self.kwargs['season']
|
||||
return PlayerData.objects.filter(season=season)
|
||||
|
||||
|
||||
# Fetch player data by player name
|
||||
class PlayerDataByNameList(generics.ListAPIView):
|
||||
serializer_class = PlayerDataSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
name = self.kwargs['name']
|
||||
return PlayerData.objects.filter(name__icontains=name)
|
||||
Reference in new issue
Block a user