mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 08:14:16 +03:00
Update to Django 2.0 Routing Syntax (#6049)
This commit is contained in:
parent
1a170438d2
commit
d9f541836b
|
@ -105,7 +105,7 @@ Because we're using `ViewSet` classes rather than `View` classes, we actually do
|
|||
|
||||
Here's our re-wired `snippets/urls.py` file.
|
||||
|
||||
from django.conf.urls import url, include
|
||||
from django.urls import path, include
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from snippets import views
|
||||
|
||||
|
@ -116,7 +116,7 @@ Here's our re-wired `snippets/urls.py` file.
|
|||
|
||||
# The API URLs are now determined automatically by the router.
|
||||
urlpatterns = [
|
||||
url(r'^', include(router.urls))
|
||||
path('', include(router.urls)),
|
||||
]
|
||||
|
||||
Registering the viewsets with the router is similar to providing a urlpattern. We include two arguments - the URL prefix for the views, and the viewset itself.
|
||||
|
|
Loading…
Reference in New Issue
Block a user