reg/management/commands/seed_db.py
author nishanth
Fri, 16 Apr 2010 17:11:47 +0530
changeset 83 b8f6bc32d8f7
parent 67 7d9a01aa3740
permissions -rwxr-xr-x
added line break in view event

import sys
from datetime import datetime

from django.core.management.base import NoArgsCommand

from django.contrib.auth.models import User

from ws_app.reg.events import create_user, create_event

def seed_db():
    """ a method to seed the database with random data """

    user = create_user('admin@fossee.in', 'Fossee321Python', 'Admin', 'Fossee')
    user.is_active = True
    user.is_staff = True
    user.is_superuser = True
    user.save()

"""    
    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()