How to pass multi optional URL parameters?
For example I want pass 2 params: my_color
and my_year
, but they are optional, so may be none of them will be passed, may be both, or may be only one.
Currently in urls.py
I have :
urlpatterns = [
re_path(r'^products/(?P<my_color>.*)/(?P<my_year>.*)$', some_view),
]
This obviously is not correct and works only if both of them are passed.
What would be correct solution?
P.S. I found answers when only one optional parameter needs to be pass, but not figured out how to do same for few parameters. Also it seems "multiple-routes option" is not solution in this case (?)