Add possibility to turn off django cauth using settings in sample

This sample is used across most of our other sites, so add functionality
to install without having a local master repo.

Back-patch of pgeu commit 3e4d8c9101c2d309b134c2f5638aa40db8ef2cf5
This commit is contained in:
Magnus Hagander
2018-01-13 18:09:27 +01:00
parent e1cda9861d
commit 38ff645d5d

View File

@ -48,6 +48,11 @@ class AuthBackend(ModelBackend):
# Handle login requests by sending them off to the main site
def login(request):
if not hasattr(settings, 'PGAUTH_REDIRECT'):
# No pgauth installed, so allow local installs.
from django.contrib.auth.views import login
return login(request, template_name='admin.html')
if request.GET.has_key('next'):
# Put together an url-encoded dict of parameters we're getting back,
# including a small nonce at the beginning to make sure it doesn't