reg/management/commands/seed_db.py
author nishanth
Thu, 08 Apr 2010 22:28:15 +0530
changeset 2 c11afa8623f7
child 23 42e2a810e1c8
permissions -rw-r--r--
incorporated gen_key .

import sys
from datetime import datetime

from django.core.management.base import NoArgsCommand

from django.contrib.auth.models import User

from workshop.reg.events import create_user, create_event

def seed_db():
    """ a method to seed the database with random data """
    
    for i in range(20):
        user = create_user('user'+str(i)+'@example.com','123456', 'User', str(i))

    for i in range(5):
        create_event("workshop"+str(i), "This is workshop"+str(i), datetime(2010, 4, i+4), datetime(2010, 4, i+6), user)
    
class Command(NoArgsCommand):
    
    def handle_noargs(self, **options):
        """ Just copied the code from seed_db.py """
        
        seed_db()