From c96217c8a61cff24e6660da98a02bd7ea877b3eb Mon Sep 17 00:00:00 2001 From: raylu Date: Fri, 13 May 2011 22:45:52 -0400 Subject: Show staff submissions to other staff --- pyc/grader/views.py | 7 ++++++- pyc/templates/lab.html | 2 +- static/style.css | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pyc/grader/views.py b/pyc/grader/views.py index 8718c5e..9c688be 100644 --- a/pyc/grader/views.py +++ b/pyc/grader/views.py @@ -19,7 +19,12 @@ def password_changed(request): def lab(request, lab_id): from datetime import timedelta lab = Lab.objects.get(pk=lab_id) - submissions = lab.submission_set.filter(user__is_staff=False).order_by('-grade', 'time') + + submissions = lab.submission_set + if not request.user.is_staff: + # only staff can see other staff solutions + submissions = submissions.filter(user__is_staff=False) + submissions = submissions.order_by('-grade', 'time') # times are stored in UTC; do the conversion here tzoffset = timedelta(0, 0, 0, 0, 0, -7) # -7 hours diff --git a/pyc/templates/lab.html b/pyc/templates/lab.html index 9586558..32a0593 100644 --- a/pyc/templates/lab.html +++ b/pyc/templates/lab.html @@ -11,7 +11,7 @@ Lab {{ lab.id }} due {{ lab.due }} at 11:59:59 PDT (UTC-7): Time {% for s in submissions %} - + {{ s.user }} {% if staff %} diff --git a/static/style.css b/static/style.css index e918c8c..0c37846 100644 --- a/static/style.css +++ b/static/style.css @@ -9,3 +9,6 @@ table#lab { border: 1px solid #000; padding: 5px; } +#lab tr.staff td { + background-color: #ddd; +} -- cgit v1.2.3