Answer the question
In order to leave comments, you need to log in
How to create a urlpattern with an arbitrary number of parameters of the same type?
How to compose a url that allows you to pass several parameters to the view, the number of which is not known in advance?
It is clear that the classical approach is as follows:
from django.conf.urls import url
from .views import desktop
from .views import users
urlpatterns = [
url(r'^desktop/$', my_view),
url(r'^desktop/users/$, users)
]
Answer the question
In order to leave comments, you need to log in
Comrades from StackOverflow recommend this solution to the issue:
urlpatterns = [
url(r'^(?P<path>[-\w/]+)/$', TemplateView.as_view()),
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question