Skip to content

Commit 54af401

Browse files
committed
Implement routing for ArtistViewSet in Django REST API
Updated the urls.py in Django REST to define routing for ArtistViewSet. This allows for more efficient access and management of artist data in the API. The original index view has been commented out for reference while the new router provides routing for ArtistViewSet.
1 parent cac0c59 commit 54af401

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

first_api/music/urls.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
from django.urls import path
1+
from django.urls import path, include
2+
from rest_framework import routers
23

34
from . import views
5+
from .views import ArtistViewSet
6+
7+
router = routers.DefaultRouter()
8+
router.register(r'artists', ArtistViewSet)
49

510
urlpatterns = [
6-
path('', views.index, name='index')
11+
path('', include(router.urls)),
12+
# path('', views.index, name='index'),
713
]

0 commit comments

Comments
 (0)