summaryrefslogtreecommitdiff
path: root/yaksh/decorators.py
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/decorators.py')
-rw-r--r--yaksh/decorators.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/yaksh/decorators.py b/yaksh/decorators.py
index 9e9bc6d..81912f0 100644
--- a/yaksh/decorators.py
+++ b/yaksh/decorators.py
@@ -1,6 +1,5 @@
-from django.shortcuts import render_to_response, redirect
+from django.shortcuts import render
from django.conf import settings
-from django.template import RequestContext
# Local imports
from yaksh.forms import ProfileForm
@@ -20,15 +19,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 +37,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 +45,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
+ return is_email_verified