from django.conf.urls import url

from . import views

app_name = 'news'
urlpatterns = [
    url(r'^$', views.IndexView.as_view(), name='index'),
    url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        views.ArticleView.as_view(), name='article'),
]

from django.urls import include, path

from . import views

app_name = 'news'
urlpatterns = [
    path('', views.IndexView.as_view(), name='index'),
    path('<int:year>/<int:month>/<int:day>/<slug:slug>/', views.ArticleView.as_view(), name='article'),
]

Move news urlpatterns to Django 2.0 preferred method
Move news urlpatterns to Django 2.0 preferred method

- from django.conf.urls import url
+ from django.urls import include, path
  
  from . import views
  
  app_name = 'news'
  urlpatterns = [
-     url(r'^$', views.IndexView.as_view(), name='index'),
+     path('', views.IndexView.as_view(), name='index'),
+     path('<int:year>/<int:month>/<int:day>/<slug:slug>/', views.ArticleView.as_view(), name='article'),
-     url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
-         views.ArticleView.as_view(), name='article'),
  ]
  
Move news urlpatterns to Django 2.0 preferred method
## Code Before:
from django.conf.urls import url

from . import views

app_name = 'news'
urlpatterns = [
    url(r'^$', views.IndexView.as_view(), name='index'),
    url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        views.ArticleView.as_view(), name='article'),
]

## Instruction:
Move news urlpatterns to Django 2.0 preferred method
## Code After:
from django.urls import include, path

from . import views

app_name = 'news'
urlpatterns = [
    path('', views.IndexView.as_view(), name='index'),
    path('<int:year>/<int:month>/<int:day>/<slug:slug>/', views.ArticleView.as_view(), name='article'),
]
