[PATCH] settings: Remove hard coded login url value
Stephen Finucane
stephen.finucane at intel.com
Fri Apr 8 23:37:16 AEST 2016
From: Michael Wood <michael.g.wood at intel.com>
Use the url name for the login page rather than a hard coded value
this means that if you have patchwork in a prefix it will redirect
to the correct location without any additional configuration.
Signed-off-by: Michael Wood <michael.g.wood at intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
---
v2:
- Use existing URL name
- Extend to cover 'LOGIN_URL' also
---
patchwork/settings/base.py | 4 ++--
patchwork/tests/test_user.py | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py
index 26236d7..bb479dd 100644
--- a/patchwork/settings/base.py
+++ b/patchwork/settings/base.py
@@ -110,8 +110,8 @@ SERVER_EMAIL = DEFAULT_FROM_EMAIL
# https://docs.djangoproject.com/en/1.6/ref/settings/#auth
#
-LOGIN_URL = '/user/login/'
-LOGIN_REDIRECT_URL = '/user/'
+LOGIN_URL = 'auth_login'
+LOGIN_REDIRECT_URL = 'user'
#
diff --git a/patchwork/tests/test_user.py b/patchwork/tests/test_user.py
index 1a42659..53482a8 100644
--- a/patchwork/tests/test_user.py
+++ b/patchwork/tests/test_user.py
@@ -17,7 +17,6 @@
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.conf import settings
from django.contrib.auth.models import User
from django.core import mail
from django.core.urlresolvers import reverse
@@ -132,7 +131,7 @@ class UserLoginRedirectTest(TestCase):
def testUserLoginRedirect(self):
url = '/user/'
response = self.client.get(url)
- self.assertRedirects(response, settings.LOGIN_URL + '?next=' + url)
+ self.assertRedirects(response, reverse('auth_login') + '?next=' + url)
class UserProfileTest(TestCase):
--
2.0.0
More information about the Patchwork
mailing list