From c906b710ba4402fb5bb24ae63fd55a4f1a18c404 Mon Sep 17 00:00:00 2001 From: Drew Larson Date: Thu, 23 Jun 2016 11:53:01 -0600 Subject: [PATCH] Fix login/logout urls. --- bikeshop_project/bikeshop/settings/base.py | 5 ++++- bikeshop_project/bikeshop/urls.py | 5 +++-- bikeshop_project/core/urls.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/bikeshop_project/bikeshop/settings/base.py b/bikeshop_project/bikeshop/settings/base.py index 8d9c7ac..6b295b7 100644 --- a/bikeshop_project/bikeshop/settings/base.py +++ b/bikeshop_project/bikeshop/settings/base.py @@ -150,4 +150,7 @@ HAYSTACK_CONNECTIONS = { 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine', 'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'), }, -} \ No newline at end of file +} + +LOGIN_REDIRECT_URL = 'home' +LOGIN_URL = 'login' \ No newline at end of file diff --git a/bikeshop_project/bikeshop/urls.py b/bikeshop_project/bikeshop/urls.py index ee00ab4..6a9c091 100644 --- a/bikeshop_project/bikeshop/urls.py +++ b/bikeshop_project/bikeshop/urls.py @@ -16,7 +16,7 @@ Including another URLconf from django.conf import settings from django.conf.urls import include, url from django.contrib import admin -from django.contrib.auth.views import login +from django.contrib.auth.views import login, logout_then_login from django.contrib.staticfiles.urls import staticfiles_urlpatterns from core import urls as core_urls @@ -24,7 +24,8 @@ from registration import urls as member_urls urlpatterns = [ url(r'^', include(core_urls)), - url(r'^login/', login, {'template_name': 'login.html'}), + url(r'^login/', login, {'template_name': 'login.html'}, name='login'), + url(r'^logout/', logout_then_login), url(r'^member/', include(member_urls)), url(r'^admin/', admin.site.urls), ] diff --git a/bikeshop_project/core/urls.py b/bikeshop_project/core/urls.py index bd1bde7..27d6f96 100644 --- a/bikeshop_project/core/urls.py +++ b/bikeshop_project/core/urls.py @@ -3,5 +3,5 @@ from django.conf.urls import url from .views import DashboardView, NewMembershipView urlpatterns = [ url(r'^member/(?P[0-9]+)/membership/new/$', NewMembershipView.as_view(), name='new_membership'), - url(r'^$', DashboardView.as_view()) + url(r'^$', DashboardView.as_view(), name='home') ]