From 39569b1db2d39f8ff50803a5c377024f0031f93b Mon Sep 17 00:00:00 2001 From: blag Date: Mon, 18 Sep 2023 13:30:37 -0700 Subject: [PATCH] Enable configurable root URL paths --- docs/installation.rst | 2 +- example/urls.py | 2 +- tests/urls.py | 2 +- user_sessions/urls.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/installation.rst b/docs/installation.rst index 48b9725..ce81ee1 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -7,7 +7,7 @@ Installation ``'django.contrib.sessions.middleware.SessionMiddleware'`` with ``'user_sessions.middleware.SessionMiddleware'``. 4. Add ``SESSION_ENGINE = 'user_sessions.backends.db'``. -5. Add ``url(r'', include('user_sessions.urls', 'user_sessions')),`` to your +5. Add ``url('account/', include('user_sessions.urls', 'user_sessions')),`` to your ``urls.py``. 6. Make sure ``LOGOUT_REDIRECT_URL`` is set to some page to redirect users after logging out. diff --git a/example/urls.py b/example/urls.py index cad7aa4..35f5ea2 100644 --- a/example/urls.py +++ b/example/urls.py @@ -14,7 +14,7 @@ ), name='home', ), - re_path(r'', include('user_sessions.urls', namespace='user_sessions')), + re_path(r'account/', include('user_sessions.urls', namespace='user_sessions')), re_path(r'^admin/', admin.site.urls), ] diff --git a/tests/urls.py b/tests/urls.py index 51a12fc..3d1ce35 100644 --- a/tests/urls.py +++ b/tests/urls.py @@ -18,5 +18,5 @@ def modify_session(request): path('', empty), path('modify_session/', modify_session), path('admin/', admin.site.urls), - path('', include('user_sessions.urls', namespace='user_sessions')), + path('account/', include('user_sessions.urls', namespace='user_sessions')), ] diff --git a/user_sessions/urls.py b/user_sessions/urls.py index e824910..6aae257 100644 --- a/user_sessions/urls.py +++ b/user_sessions/urls.py @@ -7,17 +7,17 @@ app_name = 'user_sessions' urlpatterns = [ path( - 'account/sessions/', + 'sessions/', view=SessionListView.as_view(), name='session_list', ), path( - 'account/sessions/other/delete/', + 'sessions/other/delete/', view=SessionDeleteOtherView.as_view(), name='session_delete_other', ), re_path( - r'^account/sessions/(?P\w+)/delete/$', + r'sessions/(?P\w+)/delete/$', view=SessionDeleteView.as_view(), name='session_delete', ),