From 47005053f9920f4a73865581d167f6ec0007a4ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Koci=C3=A1n?= Date: Fri, 20 Jan 2017 22:49:45 +0100 Subject: [PATCH] admin: fix get_readonly_fields --- seminar/admin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/seminar/admin.py b/seminar/admin.py index 811a309d..47e065a9 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -417,9 +417,9 @@ class ProblemAdmin(VersionAdmin): readonly_fields = ['timestamp', 'import_dakos_id'] if not obj: return readonly_fields - if obj.cislo_zadani.faze != 'admin': + if obj.cislo_zadani and obj.cislo_zadani.faze != 'admin': readonly_fields += ['nazev', 'text_zadani', 'body'] - if obj.cislo_reseni.faze != 'admin': + if obj.cislo_reseni and obj.cislo_reseni.faze != 'admin': readonly_fields += ['text_reseni'] return readonly_fields