Skip to content

Commit

Permalink
Additional changes for Django 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Bouke committed Dec 8, 2015
1 parent 94cb895 commit f4b0328
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 17 deletions.
25 changes: 21 additions & 4 deletions example/settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

DEBUG = True
TEMPLATE_DEBUG = True

PROJECT_PATH = os.path.dirname(__file__)

Expand Down Expand Up @@ -31,9 +30,27 @@

ROOT_URLCONF = 'example.urls'

TEMPLATE_DIRS = (
os.path.join(PROJECT_PATH, 'templates'),
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(PROJECT_PATH, 'templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
],
'debug': True,
},
},
]

INSTALLED_APPS = (
'django.contrib.admin',
Expand Down
7 changes: 3 additions & 4 deletions example/urls.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from django.conf.urls import patterns, include, url
from django.conf.urls import include, url

from django.contrib import admin
from django.core.urlresolvers import reverse_lazy
from django.views.generic.base import RedirectView

admin.autodiscover()

urlpatterns = patterns(
'',
urlpatterns = [
url(
regex=r'^$',
view=RedirectView.as_view(
Expand All @@ -18,4 +17,4 @@
),
url(r'', include('user_sessions.urls', 'user_sessions')),
url(r'^admin/', include(admin.site.urls)),
)
]
21 changes: 21 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,27 @@
}
}

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
],
},
},
]

GEOIP_PATH = os.path.join(os.path.dirname(BASE_DIR),
'example', 'GeoLiteCity.dat')
SESSION_ENGINE = 'user_sessions.backends.db'
7 changes: 3 additions & 4 deletions tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import patterns, url, include
from django.conf.urls import url, include
from django.contrib import admin
from django.http import HttpResponse

Expand All @@ -15,10 +15,9 @@ def modify_session(request):
return HttpResponse('')


urlpatterns = patterns(
'',
urlpatterns = [
url(r'^$', empty),
url(r'^modify_session/$', modify_session),
url(r'^admin/', include(admin.site.urls)),
url(r'', include('user_sessions.urls', 'user_sessions')),
)
]
8 changes: 3 additions & 5 deletions user_sessions/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from django.conf.urls import patterns, url
from django.conf.urls import url
from user_sessions.views import SessionDeleteOtherView

from .views import SessionListView, SessionDeleteView


urlpatterns = patterns(
'',

urlpatterns = [
url(
regex=r'^account/sessions/$',
view=SessionListView.as_view(),
Expand All @@ -22,4 +20,4 @@
view=SessionDeleteView.as_view(),
name='session_delete',
),
)
]

0 comments on commit f4b0328

Please sign in to comment.