I have a question regarding conversion of pre - Django 2 urls
to path
If I have an url like this:
url(
r'^some_path/(?P<type>type_one|type_two)/',
views.SomeViewHere.as_view(),
name='important_name',
),
Question is how to convert this url
to modern Django path
keeping same functionality and keeping same name?
Important aspect: kwargs type_one
and type_two
should be passed into view. Name
parameter can’t be changed or split.
What I have done:
path('some_path/', include(
[
path('type_one/', views.SomeViewHere.as_view(), kwargs={'type': 'type_one'}),
path('type_two/', views.SomeViewHere.as_view(), kwargs={'type': 'type_two'}),
]
), name='important_name',
),
But reverce
doesn’t work with this configuration
Thank you.
ps. type
is a string