mirror of
https://github.com/nprasad2077/nbaStats.git
synced 2026-11-04 17:19:54 +00:00
21 lines
523 B
Python
21 lines
523 B
Python
from django.shortcuts import render
|
|
from django.http import JsonResponse
|
|
from django.core import serializers
|
|
from .models import PlayerData
|
|
from rest_framework import generics
|
|
from .serializers import PlayerDataSerializer
|
|
|
|
|
|
# Create your views here.
|
|
|
|
# API view to list all PlayerData instances
|
|
class PlayerDataList(generics.ListCreateAPIView):
|
|
queryset = PlayerData.objects.all()
|
|
serializer_class = PlayerDataSerializer
|
|
|
|
|
|
# Fetch player data by team
|
|
|
|
class PlayerDataByTeamList(generics.ListAPIView):
|
|
|