From f2309db2490ec0bd5b910c5acd1dc18026a14306 Mon Sep 17 00:00:00 2001 From: Prabhu Ramachandran Date: Mon, 21 Nov 2011 17:45:22 +0530 Subject: ENH: Added an active attribute to Questions. This allows us to enable/disable questions in a question paper. Only questions that are active are used to create a question paper. I've also modified the load_exam/load_questions_xml to deactivate rather than delete old questions. --- exam/management/commands/load_questions_xml.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'exam/management/commands/load_questions_xml.py') diff --git a/exam/management/commands/load_questions_xml.py b/exam/management/commands/load_questions_xml.py index 1e9cfde..aa403dd 100644 --- a/exam/management/commands/load_questions_xml.py +++ b/exam/management/commands/load_questions_xml.py @@ -18,9 +18,10 @@ def decode_html(html_str): lambda m: unichr(name2codepoint[m.group(1)]), html_str) def clear_questions(): - """Delete all questions from the database.""" + """Deactivate all questions from the database.""" for question in Question.objects.all(): - question.delete() + question.active = False + question.save() def load_questions_xml(filename): """Load questions from the given XML file.""" -- cgit