quiz/management/commands/seed_db.py
author nishanth
Wed, 21 Apr 2010 12:11:19 +0530
changeset 29 ea1c0110e989
parent 22 fe197c0c9903
permissions -rw-r--r--
fixed the display of question
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
     1
import sys
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
     2
from datetime import datetime
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
     3
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
     4
from django.core.management.base import NoArgsCommand
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
     5
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
     6
from offline.event.models import Event
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
     7
from offline.quiz.models import QuestionBank
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
     8
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
     9
def seed_db():
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    10
    ev = Event()
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    11
    ev.title = "Some Workshop"
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    12
    ev.start_date = datetime.now()
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    13
    ev.stop_date = datetime.now()
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    14
    ev.quiz_status = '11'
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    15
    ev.save()
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    16
    
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    17
class Command(NoArgsCommand):
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    18
    
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    19
    def handle_noargs(self, **options):
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    20
        """ Just copied the code from seed_db.py """
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    21
        
99af908a4174 added questions thro seed_db
nishanth
parents:
diff changeset
    22
        seed_db()