def index(request): """if student, redirect them to timesheet. if faculty allow this page """ if 'next' in request.GET and request.GET['next'] != "/": return HttpResponseRedirect(request.GET['next']) if request.user.is_staff: try: # Warn users of IE and Firefox < 4.0 they are not supported ua = request.META['HTTP_USER_AGENT'] browser_name = httpagentparser.detect(ua)['browser']['name'] browser_version = httpagentparser.detect(ua)['browser']['version'] if browser_name == "Microsoft Internet Explorer": messages.warning(request, mark_safe('Warning Internet Explorer is not supported on the admin site. If you ' \ 'have any trouble, try using a standards compliant browser such as Firefox, Chrome, Opera, or Safari.')) elif browser_name == "Firefox" and int(browser_version.split('.')[0]) < 6: messages.warning(request, 'Warning, your version of Firefox is out of date. Please upgrade.') except: pass return HttpResponseRedirect('/sis/dashboard') elif request.user.groups.filter(Q(name='students')).count() > 0: return student_redirect(request) elif request.user.groups.filter(name='family').count() > 0: return family_redirect(request) elif request.user.groups.filter(Q(name='company')).count() > 0: from ecwsp.work_study.views import supervisor_dash return supervisor_dash(request) else: return render_to_response('base.html', {'msg': "Not authorized", 'request': request,}, RequestContext(request, {}))
def index(request): """if student, redirect them to timesheet. if faculty allow this page """ if 'next' in request.GET and request.GET['next'] != "/": return HttpResponseRedirect(request.GET['next']) if request.user.is_staff: try: # Warn users of IE and Firefox < 4.0 they are not supported ua = request.META['HTTP_USER_AGENT'] browser_name = httpagentparser.detect(ua)['browser']['name'] browser_version = httpagentparser.detect(ua)['browser']['version'] if browser_name == "Microsoft Internet Explorer": messages.warning(request, mark_safe('Warning Internet Explorer is not supported on the admin site. If you ' \ 'have any trouble, try using a standards compliant browser such as Firefox, Chrome, Opera, or Safari.')) except: pass return HttpResponseRedirect('/sis/dashboard') elif request.user.groups.filter(Q(name='students')).count() > 0: return student_redirect(request) elif request.user.groups.filter(name='family').count() > 0: return family_redirect(request) elif request.user.groups.filter(Q(name='company')).count() > 0: from ecwsp.work_study.views import supervisor_dash return supervisor_dash(request) else: return render_to_response('base.html', { 'msg': "Not authorized", 'request': request, }, RequestContext(request, {}))
def index(request): """if student, redirect them to timesheet. if faculty allow this page """ if "next" in request.GET and request.GET["next"] != "/": return HttpResponseRedirect(request.GET["next"]) if request.user.is_staff: try: # Warn users of IE and Firefox < 4.0 they are not supported ua = request.META["HTTP_USER_AGENT"] browser_name = httpagentparser.detect(ua)["browser"]["name"] browser_version = httpagentparser.detect(ua)["browser"]["version"] if browser_name == "Microsoft Internet Explorer": messages.warning( request, mark_safe( "Warning Internet Explorer is not supported on the admin site. If you " "have any trouble, try using a standards compliant browser such as Firefox, Chrome, Opera, or Safari." ), ) except: pass return HttpResponseRedirect("/sis/dashboard") elif request.user.groups.filter(Q(name="students")).count() > 0: return student_redirect(request) elif request.user.groups.filter(name="family").count() > 0: return family_redirect(request) elif request.user.groups.filter(Q(name="company")).count() > 0: from ecwsp.work_study.views import supervisor_dash return supervisor_dash(request) else: return render_to_response( "base.html", {"msg": "Not authorized", "request": request}, RequestContext(request, {}) )
def index(request): """if student, redirect them to timesheet. if faculty allow this page """ if 'next' in request.GET and request.GET['next'] != "/": return HttpResponseRedirect(request.GET['next']) if request.user.is_staff: return HttpResponseRedirect('/sis/dashboard') elif request.user.groups.filter(Q(name='students')).count() > 0: return student_redirect(request) elif request.user.groups.filter(name='family').count() > 0: return family_redirect(request) elif request.user.groups.filter(Q(name='company')).count() > 0: from ecwsp.work_study.views import supervisor_dash return supervisor_dash(request) else: return render_to_response( 'base.html', {'msg': "Not authorized", 'request': request}, RequestContext(request, {}))
def index(request): """if student, redirect them to timesheet. if faculty allow this page """ if 'next' in request.GET and request.GET['next'] != "/": return HttpResponseRedirect(request.GET['next']) if request.user.is_staff: return HttpResponseRedirect('/sis/dashboard') elif request.user.groups.filter(Q(name='students')).count() > 0: return student_redirect(request) elif request.user.groups.filter(name='family').count() > 0: return family_redirect(request) elif request.user.groups.filter(Q(name='company')).count() > 0: from ecwsp.work_study.views import supervisor_dash return supervisor_dash(request) else: return render_to_response('base.html', { 'msg': "Not authorized", 'request': request }, RequestContext(request, {}))