import sys
from datetime import datetime
from random import randrange
from django.core.management.base import NoArgsCommand
from django.contrib.auth.models import User
from testapp.models import Test_User
def seed_db():
""" a method to seed the database with random data """
# defaultMentor = userEvents.createSuUser("admin", "admin@example.com", "123456", datetime.now(), "M")
# mentor_profile = defaultMentor.get_profile()
# userEvents.updateProfile(mentor_profile, {'rights':"AD"})
for i in range(1,21):
username = 'user'+str(i)
email = username+'@example.com'
password = '123456'
fullname='user user'
# dob = datetime.now()
# gender = "M"
# user = userEvents.createUser(username,email,password,dob,gender)
# create_notification("NU", user)
user=User.objects.create_user(username=username,email=email,password=password)
user.is_active = True
user.save()
test_user=Test_User(user_id=user.id,fullname=fullname)
test_user.save()
class Command(NoArgsCommand):
def handle_noargs(self, **options):
""" Just copied the code from seed_db.py """
seed_db()