From 6266deb876d779d73c41025748f510f9e92f50b9 Mon Sep 17 00:00:00 2001 From: Samuel Gaist <samuel.gaist@idiap.ch> Date: Wed, 7 Mar 2018 15:18:01 +0100 Subject: [PATCH] [registration][views] Moved from render_to_response to render render_to_response is deprecated in Django 2.0 and render has been available since 1.3. It's shorter to write and avoids the writing of context_instance=RequestContext(request) in each of its call. --- beat/web/ui/registration/views.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/beat/web/ui/registration/views.py b/beat/web/ui/registration/views.py index 2db209b71..e1701e813 100644 --- a/beat/web/ui/registration/views.py +++ b/beat/web/ui/registration/views.py @@ -34,8 +34,7 @@ Views which allow users to create and activate accounts. from django.conf import settings from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect -from django.shortcuts import render_to_response -from django.template import RequestContext +from django.shortcuts import render from django.views.decorators.csrf import csrf_protect from .forms import RegistrationFormTermsOfService @@ -97,10 +96,10 @@ def activate(request, activation_key, context = RequestContext(request) for key, value in extra_context.items(): context[key] = callable(value) and value() or value - return render_to_response(template_name, - { 'account': account, - 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS }, - context_instance=context) + return render(request, + template_name, + { 'account': account, + 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS }) @csrf_protect @@ -203,12 +202,11 @@ def register(request, success_url=None, for key, value in extra_context.items(): context[key] = callable(value) and value() or value - return render_to_response( - template_name, - { - 'form': form, - 'form_supervisor': form_supervisor, - 'supervisor_form_active': supervisor_form_active, - 'url_prefix':settings.URL_PREFIX, - }, - context_instance=context) + return render(request, + template_name, + { + 'form': form, + 'form_supervisor': form_supervisor, + 'supervisor_form_active': supervisor_form_active, + 'url_prefix':settings.URL_PREFIX, + }) -- GitLab