Skip to content

Commit 3ecd5d2

Browse files
committed
Add ArtistViewSet in music/views.py
Expanded the music/views.py file to include the ArtistViewSet class. Artist model data can now be efficiently accessed and managed using the Django REST API. This class handles routing for ArtistViewSet, thus improving data accessibility and manipulation.
1 parent 54af401 commit 3ecd5d2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

first_api/music/views.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
from django.http import HttpResponse
2+
from rest_framework import viewsets
3+
4+
from music.models import Artist
5+
from music.serializers import ArtistSerializer
26

37

48
def index(_request):
59
return HttpResponse("My first API!")
10+
11+
12+
class ArtistViewSet(viewsets.ModelViewSet):
13+
queryset = Artist.objects.all()
14+
serializer_class = ArtistSerializer

0 commit comments

Comments
 (0)