From 4ae4de2b41eee727eaea2f3dc0eebad6a0ba9282 Mon Sep 17 00:00:00 2001 From: mahesh Date: Tue, 19 Apr 2016 17:06:59 +0530 Subject: added admin tools link --- tbc/templates/base.html | 1 + 1 file changed, 1 insertion(+) (limited to 'tbc') diff --git a/tbc/templates/base.html b/tbc/templates/base.html index a1b4c8f..c607411 100755 --- a/tbc/templates/base.html +++ b/tbc/templates/base.html @@ -148,6 +148,7 @@
  • Get Certificate
  • Update Profile
  • Update Password
  • +
  • Admin Tools
  • Logout
  • -- cgit From 836b299d19efd65220660d8efd37deaf41894d71 Mon Sep 17 00:00:00 2001 From: mahesh Date: Tue, 19 Apr 2016 17:24:52 +0530 Subject: admin tools only visible to reviewers --- tbc/templates/base.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tbc') diff --git a/tbc/templates/base.html b/tbc/templates/base.html index c607411..40812eb 100755 --- a/tbc/templates/base.html +++ b/tbc/templates/base.html @@ -133,7 +133,6 @@
  • Get Certificate
  • Update Profile
  • Update Password
  • -
  • Admin Tools
  • Logout
  • @@ -148,7 +147,6 @@
  • Get Certificate
  • Update Profile
  • Update Password
  • -
  • Admin Tools
  • Logout
  • @@ -161,7 +159,9 @@ {% endif %} -- cgit From cd5281517607402cc05c3c9a237327f467a28dea Mon Sep 17 00:00:00 2001 From: mahesh Date: Thu, 21 Apr 2016 12:37:04 +0530 Subject: added Http404 for admin-tools --- tbc/views.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'tbc') diff --git a/tbc/views.py b/tbc/views.py index 767dd4e..18e2d4d 100755 --- a/tbc/views.py +++ b/tbc/views.py @@ -1,6 +1,6 @@ from django.utils.encoding import force_text from django.contrib.contenttypes.models import ContentType -from django.http import HttpResponse, HttpResponseRedirect +from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.shortcuts import render_to_response, redirect from django.views.decorators.csrf import csrf_exempt from django.core.context_processors import csrf @@ -1189,6 +1189,7 @@ def BrowseBooks(request): return render_to_response('tbc/browse-books.html', context) + def ConvertNotebook(request, notebook_path=None): """ Checks for the modified time of ipython notebooks and corresponding html page and replaces html page with new one if corresponding ipython notebook has been modified. """ @@ -1417,8 +1418,10 @@ def link_image(request): @login_required( login_url= "/admin") def admin_tools(request): ci = RequestContext(request) - user = request.user - context = {"user":user} - return render_to_response('tbc/admin-tools.html', context, context_instance=ci) - - + curr_user = request.user + + if not is_reviewer(curr_user): + raise Http404("You are not allowed to view this page") + else: + context = {"user":curr_user} + return render_to_response('tbc/admin-tools.html', context, context_instance=ci) -- cgit