[06/11] Prepare for Django 2.0

Message ID 20180624195557.19909-6-stephen@that.guru
State Accepted
Headers show
Series
  • [01/11] REST: Check.user is not read-only
Related show

Commit Message

Stephen Finucane June 24, 2018, 7:55 p.m.
Two changes necessary.

- Remove 'SessionAuthenticationMiddleware' from settings

  https://docs.djangoproject.com/en/2.0/releases/2.0/#miscellaneous

- Replace 'render_to_response' with 'render'

  https://docs.djangoproject.com/en/2.0/releases/2.0/#miscellaneous

Both of these are supported by Django 1.11 so there's no need for compat
wrappers.

Signed-off-by: Stephen Finucane <stephen@that.guru>
---
 patchwork/settings/base.py | 1 -
 patchwork/views/cover.py   | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

Patch

diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py
index 99eb3c06..acfb0164 100644
--- a/patchwork/settings/base.py
+++ b/patchwork/settings/base.py
@@ -32,7 +32,6 @@  MIDDLEWARE = [
     'django.contrib.admindocs.middleware.XViewMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
-    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 ]
 
 TIME_ZONE = 'Australia/Canberra'
diff --git a/patchwork/views/cover.py b/patchwork/views/cover.py
index f18a262f..aada6834 100644
--- a/patchwork/views/cover.py
+++ b/patchwork/views/cover.py
@@ -21,7 +21,7 @@  from django.http import Http404
 from django.http import HttpResponse
 from django.http import HttpResponseRedirect
 from django.shortcuts import get_object_or_404
-from django.shortcuts import render_to_response
+from django.shortcuts import render
 from django.urls import reverse
 
 from patchwork.models import CoverLetter
@@ -45,7 +45,7 @@  def cover_detail(request, cover_id):
         'project': cover.project,
     }
 
-    return render_to_response('patchwork/submission.html', context)
+    return render(request, 'patchwork/submission.html', context)
 
 
 def cover_mbox(request, cover_id):