S
S
siarheisiarhei2020-03-05 20:41:06
Django
siarheisiarhei, 2020-03-05 20:41:06

Django2 to Django3, url to path...?

Works.

urlpatterns = [
re_path('(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
]

Does not work. What can (not)...?
urlpatterns = [
path('(<int:year_id>/<int:month_id>/<int:day_id>/<int:slug_id>',
]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Kitaev, 2020-03-05
@deliro

Obviously different capturing group names, different group types and extra parenthesis

V
Vladimir, 2020-03-06
@Realmixer

urlpatterns = [
    re_path('<int:year>/<int:month>/<int:day>/<slug:slug>/'),
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question