summaryrefslogtreecommitdiff
path: root/yaksh/decorators.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2018-05-09 19:19:55 +0530
committerGitHub2018-05-09 19:19:55 +0530
commit9248e11d935a0b80433bcc80f66fb4ad40f3adb3 (patch)
treefd3fe2bd36111658ff792b8549f906707c3b81fb /yaksh/decorators.py
parent31764f78f091122a745a7da2d98e18160cb35eba (diff)
parent3847021649a1abc2a7ccf589759aee9a84f2915d (diff)
downloadonline_test-9248e11d935a0b80433bcc80f66fb4ad40f3adb3.tar.gz
online_test-9248e11d935a0b80433bcc80f66fb4ad40f3adb3.tar.bz2
online_test-9248e11d935a0b80433bcc80f66fb4ad40f3adb3.zip
Merge pull request #466 from ankitjavalkar/remove-ctx-instance
Remove the context instance argument in views.py
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..4b886a3 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, 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