@@ -260,7 +260,7 @@ practice would be to create a URLconf just for the API portion of your site.::
260260
261261 # The ``settings.ROOT_URLCONF`` file
262262 # myproject/urls.py
263- from django.conf. urls import url , include
263+ from django.urls import path , include
264264
265265 # Add this!
266266 from posts.api import PostResource
@@ -269,7 +269,7 @@ practice would be to create a URLconf just for the API portion of your site.::
269269 # The usual fare, then...
270270
271271 # Add this!
272- url(r 'api/posts/', include(PostResource.urls())),
272+ path( 'api/posts/', include(PostResource.urls())),
273273 ]
274274
275275Note that unlike some other CBVs (admin specifically), the ``urls `` here is a
@@ -284,8 +284,8 @@ You can also manually hook up URLs by specifying something like::
284284 # ...
285285
286286 # Identical to the above.
287- url(r 'api/posts/$ ', PostResource.as_list(), name='api_post_list'),
288- url(r 'api/posts/(?P <pk>\d+)/$ ', PostResource.as_detail(), name='api_post_detail'),
287+ path( 'api/posts/', PostResource.as_list(), name='api_post_list'),
288+ path( 'api/posts/<pk>/ ', PostResource.as_detail(), name='api_post_detail'),
289289 ]
290290
291291
0 commit comments