From 25da5b8159bea9655e1a1ed15cc414896a31a7eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Fri, 8 Nov 2013 15:26:36 +0100 Subject: [PATCH] Handle admin user without assigned questions --- wtem/admin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wtem/admin.py b/wtem/admin.py index 5c495ec..47e0a77 100644 --- a/wtem/admin.py +++ b/wtem/admin.py @@ -13,8 +13,11 @@ from .middleware import get_current_request def get_user_exercises(user): - assignment = Assignment.objects.get(user = user) - return [e for e in exercises if e['id'] in assignment.exercises] + try: + assignment = Assignment.objects.get(user = user) + return [e for e in exercises if e['id'] in assignment.exercises] + except Assignment.DoesNotExist: + return [] readonly_fields = ('submitted_by', 'first_name', 'last_name', 'email', 'key', 'key_sent') -- 2.20.1