Skip to content

Commit 310fe65

Browse files
committed
Making this module compatible with the Current LTS version of Django
1 parent e2da620 commit 310fe65

File tree

4 files changed

+28
-27
lines changed

4 files changed

+28
-27
lines changed

demo-django/demo/settings.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
# SECURITY WARNING: don't run with debug turned on in production!
2323
DEBUG = True
2424

25-
TEMPLATE_DEBUG = True
26-
2725
ALLOWED_HOSTS = []
2826

2927

@@ -85,6 +83,15 @@
8583

8684
SESSION_ENGINE = 'django.contrib.sessions.backends.file'
8785

88-
TEMPLATE_DIRS = (
89-
os.path.join(BASE_DIR, 'templates'),
90-
)
86+
TEMPLATES = [
87+
{
88+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
89+
'DIRS': [os.path.join(BASE_DIR, 'templates')],
90+
'APP_DIRS': True,
91+
'OPTIONS': {
92+
'context_processors': {
93+
'django.contrib.auth.context_processors.auth'
94+
}
95+
},
96+
},
97+
]

demo-django/demo/urls.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
from django.conf.urls import patterns, url
2-
1+
from django.conf.urls import url
32
from django.contrib import admin
3+
from demo.views import index, attrs, metadata
4+
45
admin.autodiscover()
56

6-
urlpatterns = patterns(
7-
'',
8-
url(r'^$', 'demo.views.index', name='index'),
9-
url(r'^attrs/$', 'demo.views.attrs', name='attrs'),
10-
url(r'^metadata/$', 'demo.views.metadata', name='metadata'),
11-
)
7+
urlpatterns = [
8+
url(r'^$', index, name='index'),
9+
url(r'^attrs/$', attrs, name='attrs'),
10+
url(r'^metadata/$', metadata, name='metadata')
11+
]
12+

demo-django/demo/views.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
from django.core.urlresolvers import reverse
33
from django.http import (HttpResponse, HttpResponseRedirect,
44
HttpResponseServerError)
5-
from django.shortcuts import render_to_response
6-
from django.template import RequestContext
5+
from django.shortcuts import render
76

87
from onelogin.saml2.auth import OneLogin_Saml2_Auth
98
from onelogin.saml2.settings import OneLogin_Saml2_Settings
@@ -97,13 +96,8 @@ def index(request):
9796
if len(request.session['samlUserdata']) > 0:
9897
attributes = request.session['samlUserdata'].items()
9998

100-
return render_to_response('index.html',
101-
{'errors': errors,
102-
'not_auth_warn': not_auth_warn,
103-
'success_slo': success_slo,
104-
'attributes': attributes,
105-
'paint_logout': paint_logout},
106-
context_instance=RequestContext(request))
99+
return render(request, 'index.html', {'errors': errors, 'not_auth_warn': not_auth_warn, 'success_slo': success_slo,
100+
'attributes': attributes, 'paint_logout': paint_logout})
107101

108102

109103
def attrs(request):
@@ -115,10 +109,9 @@ def attrs(request):
115109
if len(request.session['samlUserdata']) > 0:
116110
attributes = request.session['samlUserdata'].items()
117111

118-
return render_to_response('attrs.html',
119-
{'paint_logout': paint_logout,
120-
'attributes': attributes},
121-
context_instance=RequestContext(request))
112+
return render(request, 'attrs.html',
113+
{'paint_logout': paint_logout,
114+
'attributes': attributes})
122115

123116

124117
def metadata(request):

demo-django/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Django==1.6.5
1+
Django==1.11

0 commit comments

Comments
 (0)