summaryrefslogtreecommitdiff
path: root/yaksh/decorators.py
diff options
context:
space:
mode:
authorankitjavalkar2018-04-02 19:30:11 +0530
committerankitjavalkar2018-04-02 19:30:11 +0530
commitef5f9a8029ec19d0a039fff821106651aea9c426 (patch)
treeee79a17f1d14af642a828d202d0d76c376c22616 /yaksh/decorators.py
parentc9beb0e2bf01af8a391cb16166cdac71bd03db32 (diff)
downloadonline_test-ef5f9a8029ec19d0a039fff821106651aea9c426.tar.gz
online_test-ef5f9a8029ec19d0a039fff821106651aea9c426.tar.bz2
online_test-ef5f9a8029ec19d0a039fff821106651aea9c426.zip
Upgrade Django from 1.9.5 to Django 1.10
- Change render_to_response usage to render
Diffstat (limited to 'yaksh/decorators.py')
-rw-r--r--yaksh/decorators.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/yaksh/decorators.py b/yaksh/decorators.py
index 9e9bc6d..0234f2f 100644
--- a/yaksh/decorators.py
+++ b/yaksh/decorators.py
@@ -1,4 +1,4 @@
-from django.shortcuts import render_to_response, redirect
+from django.shortcuts import render, render_to_response, redirect
from django.conf import settings
from django.template import RequestContext
@@ -20,15 +20,13 @@ def has_profile(func):
def _wrapped_view(request, *args, **kwargs):
if user_has_profile(request.user):
return func(request, *args, **kwargs)
- ci = RequestContext(request)
if request.user.groups.filter(name='moderator').exists():
template = 'manage.html'
else:
template = 'user.html'
form = ProfileForm(user=request.user, instance=None)
context = {'template': template, 'form': form}
- return render_to_response('yaksh/editprofile.html', context,
- context_instance=ci)
+ return render(request, 'yaksh/editprofile.html', context)
return _wrapped_view
@@ -40,7 +38,6 @@ def email_verified(func):
"""
def is_email_verified(request, *args, **kwargs):
- ci = RequestContext(request)
user = request.user
context = {}
if not settings.IS_DEVELOPMENT:
@@ -49,7 +46,8 @@ def email_verified(func):
context['success'] = False
context['msg'] = "Your account is not verified. \
Please verify your account"
- return render_to_response('yaksh/activation_status.html',
- context, context_instance=ci)
+ return render(
+ request, 'yaksh/activation_status.html', context
+ )
return func(request, *args, **kwargs)
return is_email_verified \ No newline at end of file