1👍
✅
Sure, there is a way. Just make the token
url parameter optional. Like this:
url(r'^users/(?P<token>[0-9a-z]+)?$', views.UserList.as_view(), name='user_profile'),
Notice the trailing ?
, which means 0 or 1 matches of the token
. If the token
is provided then it’ll be the value provided (obviously!). If not, it will be None
.
Source:stackexchange.com