-
Notifications
You must be signed in to change notification settings - Fork 0
/
urls.py
37 lines (33 loc) · 916 Bytes
/
urls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from django.urls import include, path
from rest_framework.routers import DefaultRouter
from .views import (
CategoryViewSet,
CommentViewSet,
GenreViewSet,
get_confirmation_code,
get_jwt_token,
ReviewViewSet,
TitleViewSet,
UserViewSet,
)
v1_router = DefaultRouter()
v1_router.register('users', UserViewSet)
v1_router.register('categories', CategoryViewSet)
v1_router.register('genres', GenreViewSet)
v1_router.register('titles', TitleViewSet)
v1_router.register(
r'titles/(?P<title>\d+)/reviews', ReviewViewSet, basename='reviews'
)
v1_router.register(
r'titles/(?P<title_id>\d+)/reviews/(?P<review_id>\d+)/comments',
CommentViewSet,
basename='comments'
)
v1_auth_patterns = [
path('mail/', get_confirmation_code),
path('token/', get_jwt_token)
]
urlpatterns = [
path('', include(v1_router.urls)),
path('auth/', include(v1_auth_patterns))
]