urls12345.py
1.24 KB
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
38
39
40
41
42
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from snippets import views
# API endpoints
urlpatterns = format_suffix_patterns([
path('', views.api_root),
path('snippets/',
views.SnippetList.as_view(),
name='snippet-list'),
path('snippets/<int:pk>/',
views.SnippetDetail.as_view(),
name='snippet-detail'),
path('snippets/<int:pk>/highlight/',
views.SnippetHighlight.as_view(),
name='snippet-highlight'),
path('users/',
views.UserList.as_view(),
name='user-list'),
path('users/<int:pk>/',
views.UserDetail.as_view(),
name='user-detail')
])
# tutorial 3&4 url
# urlpatterns = [
# path('snippets/', views.SnippetList.as_view()),
# path('snippets/<int:pk>/', views.SnippetDetail.as_view()),
# path('users/', views.UserList.as_view()),
# path('users/<int:pk>/', views.UserDetail.as_view()),
# path('', views.api_root),
# path('snippets/<int:pk>/highlight/', views.SnippetHighlight.as_view()),
# ]
# tutorial. 1&2 url
# urlpatterns = [
# path('snippets/', views.snippet_list),
# path('snippets/<int:pk>/', views.snippet_detail),
# ]
# urlpatterns = format_suffix_patterns(urlpatterns)