from django.conf.urls import url
from django.contrib import admin

from .views import ArticleView, PageView


urlpatterns = [
    url(r"^admin/", admin.site.urls),
    url(r"^articles/(?P<pk>\d+)/$", ArticleView.as_view(), name="article_detail"),
    url(r"^pages/(?P<pk>\d+)/$", PageView.as_view(), name="page_detail"),
]

from django.urls import re_path
from django.contrib import admin

from .views import ArticleView, PageView


urlpatterns = [
    re_path(r"^admin/", admin.site.urls),
    re_path(r"^articles/(?P<pk>\d+)/$", ArticleView.as_view(), name="article_detail"),
    re_path(r"^pages/(?P<pk>\d+)/$", PageView.as_view(), name="page_detail"),
]

Switch from url() to re_path()
Switch from url() to re_path()

- from django.conf.urls import url
+ from django.urls import re_path
  from django.contrib import admin
  
  from .views import ArticleView, PageView
  
  
  urlpatterns = [
-     url(r"^admin/", admin.site.urls),
+     re_path(r"^admin/", admin.site.urls),
-     url(r"^articles/(?P<pk>\d+)/$", ArticleView.as_view(), name="article_detail"),
+     re_path(r"^articles/(?P<pk>\d+)/$", ArticleView.as_view(), name="article_detail"),
-     url(r"^pages/(?P<pk>\d+)/$", PageView.as_view(), name="page_detail"),
+     re_path(r"^pages/(?P<pk>\d+)/$", PageView.as_view(), name="page_detail"),
  ]
  
Switch from url() to re_path()
## Code Before:
from django.conf.urls import url
from django.contrib import admin

from .views import ArticleView, PageView


urlpatterns = [
    url(r"^admin/", admin.site.urls),
    url(r"^articles/(?P<pk>\d+)/$", ArticleView.as_view(), name="article_detail"),
    url(r"^pages/(?P<pk>\d+)/$", PageView.as_view(), name="page_detail"),
]

## Instruction:
Switch from url() to re_path()
## Code After:
from django.urls import re_path
from django.contrib import admin

from .views import ArticleView, PageView


urlpatterns = [
    re_path(r"^admin/", admin.site.urls),
    re_path(r"^articles/(?P<pk>\d+)/$", ArticleView.as_view(), name="article_detail"),
    re_path(r"^pages/(?P<pk>\d+)/$", PageView.as_view(), name="page_detail"),
]
