From 065ceb5c39927bb8da6fd41254dcfaad91d5b758 Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Tue, 13 May 2014 14:09:25 -0400 Subject: [PATCH] Issues with quiz creation --- karmaworld/apps/quizzes/create_quiz.py | 3 ++- karmaworld/apps/quizzes/models.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/karmaworld/apps/quizzes/create_quiz.py b/karmaworld/apps/quizzes/create_quiz.py index cd3bb6c..076a368 100644 --- a/karmaworld/apps/quizzes/create_quiz.py +++ b/karmaworld/apps/quizzes/create_quiz.py @@ -1,3 +1,4 @@ +from copy import copy import random from karmaworld.apps.quizzes.models import Keyword @@ -107,7 +108,7 @@ def _create_keyword_definition_true_false(keyword, keywords): def quiz_from_keywords(note): - keywords = Keyword.objects.filter(note=note) + keywords = Keyword.objects.filter(note=note).exclude(word__iexact='').exclude(definition__iexact='') questions = [] if len(keywords) < 4: diff --git a/karmaworld/apps/quizzes/models.py b/karmaworld/apps/quizzes/models.py index c9a89a6..36186a4 100644 --- a/karmaworld/apps/quizzes/models.py +++ b/karmaworld/apps/quizzes/models.py @@ -17,5 +17,5 @@ class Keyword(models.Model): unique_together = ('word', 'note', 'ranges') def __unicode__(self): - return self.word + return u"{w}: {d}".format(w=self.word, d=self.definition) -- 2.25.1