forked from expo/troggle
Get CSRF middleware to work on django 1.1- and 1.2+
This commit is contained in:
parent
9becad0d9a
commit
925ed4635b
@ -1,6 +1,7 @@
|
|||||||
from localsettings import * #inital localsettings call so that urljoins work
|
from localsettings import * #inital localsettings call so that urljoins work
|
||||||
import os
|
import os
|
||||||
import urlparse
|
import urlparse
|
||||||
|
import django
|
||||||
# Django settings for troggle project.
|
# Django settings for troggle project.
|
||||||
|
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
@ -58,12 +59,17 @@ TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.auth", "core.con
|
|||||||
|
|
||||||
LOGIN_REDIRECT_URL = '/'
|
LOGIN_REDIRECT_URL = '/'
|
||||||
|
|
||||||
|
if django.VERSION[0] >=1 and django.VERSION[1] > 1:
|
||||||
|
csrfmiddleware = 'django.middleware.csrf.CsrfViewMiddleware'
|
||||||
|
else:
|
||||||
|
csrfmiddleware = 'django.contrib.csrf.middleware.CsrfMiddleware'
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
|
'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
csrfmiddleware,
|
||||||
'troggle.middleware.SmartAppendSlashMiddleware'
|
'troggle.middleware.SmartAppendSlashMiddleware'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user