quiz/management/commands/seed_db.py
author nishanth
Thu, 22 Apr 2010 12:17:21 +0530
changeset 50 0842b3439c3e
parent 29 ea1c0110e989
permissions -rw-r--r--
implemented extra filter on string patterns. now string patterns will not be split like other pattersns
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()