Issues with quiz creation
authorCharles Connell <charles@connells.org>
Tue, 13 May 2014 18:09:25 +0000 (14:09 -0400)
committerCharles Connell <charles@connells.org>
Tue, 13 May 2014 18:09:25 +0000 (14:09 -0400)
karmaworld/apps/quizzes/create_quiz.py
karmaworld/apps/quizzes/models.py

index cd3bb6c1e6c0db193d79acd94413de84ac83b6e9..076a368bf25a82c569f0c19ad8a78f2b419cf2d4 100644 (file)
@@ -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:
index c9a89a67c6841224c80225359c8e88fe7dc320aa..36186a4d792fe821c1e4e5337a44370a83fe1e97 100644 (file)
@@ -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)