quiz/management/commands/seed_que.py
changeset 46 b45bb982ae24
parent 28 456b7b9e3d13
child 49 3643f59f141e
equal deleted inserted replaced
45:3be60e26e14f 46:b45bb982ae24
     1 from xml.dom.minidom import parse, Node
     1 from xml.dom.minidom import parse, Node
     2 
     2 
     3 from django.core.management.base import NoArgsCommand
     3 from django.core.management.base import NoArgsCommand
     4 
     4 
     5 from offline.quiz.models import QuestionBank
     5 from offline.quiz.models import QuestionBank, Quiz
     6 
     6 
     7 name2num = {"day1quiz1" : "11",
     7 name2num = {"day1quiz1" : "11",
     8             "day1quiz2" : "12",
     8             "day1quiz2" : "12",
     9             "day2quiz1" : "21",
     9             "day2quiz1" : "21",
    10            }
    10            }
    40                                     options = options,
    40                                     options = options,
    41                                     code = code,
    41                                     code = code,
    42                                     expected_ans = expected_ans,
    42                                     expected_ans = expected_ans,
    43                                    )
    43                                    )
    44         new_question.save()
    44         new_question.save()
    45 
       
    46 
       
    47     
    45     
    48 class Command(NoArgsCommand):
    46 class Command(NoArgsCommand):
    49     
    47     
    50     def handle_noargs(self, **options):
    48     def handle_noargs(self, **options):
    51         """ Just copied the code from seed_db.py """
    49         """ Just copied the code from seed_db.py """