1👍
✅
You redirect to:
return redirect('room', room_name=user.team_id)
Where 'room'
is the name of the view, and room_name=user.team_id
the value for the room_name
parameter in the url.
You however should reorder the urls such that the room
view is last, otherwise if you visit logout/
it will trigger the room
view with logout
as room_name
:
urlpatterns = [
path('', index, name='index'),
path('login/', auth_views.LoginView.as_view(template_name='Team/login.html'), name='login'),
path('register/', registration_view, name='register'),
# ↓ before the room view
path('logout/', logout_user, name="logout"),
path('<str:room_name>/', room, name='room'),
]
Source:stackexchange.com