Change csrf imports and database settings for django 1.4
authorDiane Trout <diane@caltech.edu>
Thu, 29 Nov 2012 00:39:43 +0000 (16:39 -0800)
committerDiane Trout <diane@caltech.edu>
Thu, 29 Nov 2012 00:39:43 +0000 (16:39 -0800)
They moved the csrf protection code from django 1.1. I needed to change
some imports in both a few modules and the settings file.

Additionally the way to specify the database changed, the
old 1.1 version is still in there as of this patch.

htsworkflow/frontend/experiments/experiments.py
htsworkflow/frontend/samples/views.py
htsworkflow/settings.py

index 1ccba526adb75272273985c0095db2361e09d40f..f24d13d5b8dc3e830b2b3c1548251886ec7f1299 100644 (file)
@@ -9,7 +9,7 @@ import os
 import re
 
 from django.contrib.auth.decorators import login_required
-from django.contrib.csrf.middleware import csrf_exempt
+from django.views.decorators.csrf import csrf_exempt
 from django.core.exceptions import ObjectDoesNotExist
 from django.core.mail import send_mail, mail_admins
 from django.http import HttpResponse, Http404
index 7150d081bd64b7fd73bb119b23ca539b38419035..610885029552ff53fc69a9f589274b923f6e5276 100644 (file)
@@ -9,7 +9,7 @@ try:
 except ImportError, e:
     import simplejson as json
 
-from django.contrib.csrf.middleware import csrf_exempt
+from django.views.decorators.csrf import csrf_exempt
 from htsworkflow.frontend.auth import require_api_key
 from htsworkflow.frontend.experiments.models import FlowCell, Lane, LANE_STATUS_MAP
 from htsworkflow.frontend.samples.changelist import ChangeList
@@ -553,5 +553,3 @@ def user_profile(request):
     context.update(SAMPLES_CONTEXT_DEFAULTS)
     return render_to_response('registration/profile.html', context,
                               context_instance=RequestContext(request))
-
-
index 13eca3d95ba1147aa4d458ead5138240eb5f444f..36f2f5168920c6db7aefd0cc6e77a6ec07f8fff1 100644 (file)
@@ -143,6 +143,13 @@ if options.has_option(database_section, 'password_file'):
 elif options.has_option(database_section, 'password'):
     DATABASE_PASSWORD = options.get(database_section, 'password')
 
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': DATABASE_NAME,
+    }
+}
+
 # Local time zone for this installation. Choices can be found here:
 # http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
 # although not all variations may be possible on all operating systems.
@@ -188,16 +195,16 @@ DEFAULT_API_KEY = 'n7HsXGHIi0vp9j5u4TIRJyqAlXYc4wrH'
 
 # List of callables that know how to import templates from various sources.
 TEMPLATE_LOADERS = (
-    'django.template.loaders.filesystem.load_template_source',
-    'django.template.loaders.app_directories.load_template_source',
-#     'django.template.loaders.eggs.load_template_source',
+    'django.template.loaders.filesystem.Loader',
+    'django.template.loaders.app_directories.Loader',
 )
 
 MIDDLEWARE_CLASSES = (
-    'django.contrib.csrf.middleware.CsrfMiddleware',
+    'django.middleware.csrf.CsrfViewMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
     'django.middleware.doc.XViewMiddleware',
 )